<commit_before>package main

import (
    "net/http"
    "fmt"
    "encoding/json"
)

func handlePing(w http.ResponseWriter, r *http.Request) {
    fmt.Fprint(w, "OK")
}

func handleRequest(w http.ResponseWriter, r *http.Request) {
    type Input struct {
        FeedId string `json:"feed_id"`
        FeedUrl string `json:"feed_url"`
    }

    if r.Method != http.MethodPost {
        http.Error(w, "Not allowed", http.StatusMethodNotAllowed)
        return
    }

    var inputs []Input
    err := json.NewDecoder(r.Body).Decode(&inputs)

    if err != nil {
        http.Error(w, err.Error(), http.StatusBadRequest)
    }

    for _, input := range inputs {
        fmt.Fprintf(w, "%s", input.FeedUrl)
    }
}

func init() {
    http.HandleFunc("/ping", handlePing)
    http.HandleFunc("/handle", handleRequest)
}
<commit_msg>Handle input with a http form, rather than JSON<commit_after>package main

import (
    "net/http"
    "fmt"
)

func handlePing(w http.ResponseWriter, r *http.Request) {
    fmt.Fprint(w, "OK")
}

type Input struct {
    FeedId string
    FeedUrl string
}

func handleRequest(w http.ResponseWriter, r *http.Request) {
    if r.Method != http.MethodPost {
        http.Error(w, "Not allowed", http.StatusMethodNotAllowed)
        return
    }

    input, err := parseInput(r)

    if err != nil {
        http.Error(w, err.Error(), http.StatusBadRequest)
    }

    fmt.Fprintf(w, "%s", input.FeedUrl)
}

func parseInput(r *http.Request) (i Input, err error) {
    feed_id := r.FormValue("feed_id")
    feed_url := r.FormValue("feed_url")

    return Input{feed_id, feed_url}, nil
}

func init() {
    http.HandleFunc("/ping", handlePing)
    http.HandleFunc("/handle", handleRequest)
}

{'fraction_non_alphanumeric': 0.1391962725684333, 'fraction_numerical': 0.0, 'mean_word_length': 2.922374429223744, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1279363', 'n_tokens_mistral': 590, 'n_tokens_neox': 579, 'n_words': 132}