Last active
December 18, 2021 10:22
-
-
Save ivanauliaa/c5017cbe1eae15116e1d2eb90ef53a89 to your computer and use it in GitHub Desktop.
Construct body params (payload) in POST request (GO)
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
param := url.Values{} | |
params.Set("id", ID) | |
payload := bytes.NewBufferString(params.Encode()) | |
request, err := http.NewRequest("POST", baseUrl+"/user", payload) | |
if err != nil { | |
return data, err | |
} | |
request.Header.Set("Content-Type", "application/x-www-form-urlencoded") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment