Skip to content

Instantly share code, notes, and snippets.

@ntsh
Created November 13, 2013 07:36
Show Gist options
  • Select an option

  • Save ntsh/7445198 to your computer and use it in GitHub Desktop.

Select an option

Save ntsh/7445198 to your computer and use it in GitHub Desktop.
package main
import (
"net/http"
"net/url"
"io/ioutil"
"fmt"
)
func main() {
resp, err := http.PostForm("http://httpbin.org/post",
url.Values{"user": {"test"}, "id": {"98765"}})
if (err != nil) {
fmt.Println("nil")
fmt.Printf("%s", err)
return
}
body, _ := ioutil.ReadAll(resp.Body)
fmt.Printf("%s", body)
resp.Body.Close()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment