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)
}


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)
}


--- 
+++ 
@@ -3,34 +3,37 @@
 import (
     "net/http"
     "fmt"
-    "encoding/json"
 )
 
 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) {
-    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)
+    input, err := parseInput(r)
 
     if err != nil {
         http.Error(w, err.Error(), http.StatusBadRequest)
     }
 
-    for _, input := range inputs {
-        fmt.Fprintf(w, "%s", input.FeedUrl)
-    }
+    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() {
Handle input with a http form, rather than JSON
