http
v0.0.0-20150129070307-b6b98df9e668
honnef.co/go/js/http
Documentation
pkg.go.dev ↗Package http is a clone of net/http for GopherJS. It replicates most of the net/http.Client API, using XHR in the background, and making use of actual types from the net/http package, such as net/http.Request and net/http.Response.
At this moment, the future of this package is not yet certain. Better solutions might present themselves, in which case this package will be removed and replaced with something better. Use at your own risk.
Variables
DefaultClient
var DefaultClient = Client{}
Functions
Get
func Get(url string) (*http.Response, error)
Head
func Head(url string) (*http.Response, error)
Post
func Post(url string, bodyType string, body io.Reader) (*http.Response, error)
Types
Client
type Client struct {
// The amount of time a request can take before it will be
// terminated. Millisecond precision is supported.
Timeout time.Duration
}
Client.Do
func (c *Client) Do(req *http.Request) (*http.Response, error)
Client.Get
func (c *Client) Get(url string) (*http.Response, error)
Client.Head
func (c *Client) Head(url string) (*http.Response, error)
Client.Post
func (c *Client) Post(url string, bodyType string, body io.Reader) (*http.Response, error)
Client.PostForm
func (c *Client) PostForm(url string, data url.Values) (*http.Response, error)