Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
  • Go

Idiom #174 Make HTTP POST request

Make a HTTP request with method POST to the URL u

import "net/http"
response, err := http.Post(u, contentType, body)

contentType is a string.
body is a io.Reader which can be nil.
import "net/http"
import "net/url"
response, err := http.PostForm(u, formValues)

formValues has type net/url.Values
using System.Net.Http;
new HttpClient().PostAsync(u, content);

New implementation...
< >
programming-idioms.org