Created
March 9, 2018 14:45
-
-
Save itwars/d42b5cede332ca8d49aa64845d3d6b1c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"net/http" | |
"io/ioutil" | |
) | |
func main() { | |
url := "https://reqres.in/api/users" | |
payload := strings.NewReader("name=test&jab=teacher") | |
req, _ := http.NewRequest("POST", url, payload) | |
req.Header.Add("content-type", "application/x-www-form-urlencoded") | |
req.Header.Add("cache-control", "no-cache") | |
res, _ := http.DefaultClient.Do(req) | |
defer res.Body.Close() | |
body, _ := ioutil.ReadAll(res.Body) | |
fmt.Println(string(body)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment