http

package module
v0.0.0-...-b6b98df Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 29, 2015 License: MIT Imports: 12 Imported by: 0

README

This is an experimental package, replicating the net/http Client API
for GopherJS.

The future of this package is not yet certain, a better solution might
appear, making this package unnecessary. As such, this package (and
repository) might disappear in the future. Consider it a proof of
concept.

Documentation

Overview

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.

Index

Constants

This section is empty.

Variables

View Source
var DefaultClient = Client{}

Functions

func Get

func Get(url string) (*http.Response, error)
func Head(url string) (*http.Response, error)

func Post

func Post(url string, bodyType string, body io.Reader) (*http.Response, error)

Types

type Client

type Client struct {
	// The amount of time a request can take before it will be
	// terminated. Millisecond precision is supported.
	Timeout time.Duration
}

func (*Client) Do

func (c *Client) Do(req *http.Request) (*http.Response, error)

func (*Client) Get

func (c *Client) Get(url string) (*http.Response, error)

func (*Client) Head

func (c *Client) Head(url string) (*http.Response, error)

func (*Client) Post

func (c *Client) Post(url string, bodyType string, body io.Reader) (*http.Response, error)

func (*Client) PostForm

func (c *Client) PostForm(url string, data url.Values) (*http.Response, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL