Versions in this module Expand all Collapse all v1 v1.3.3 Oct 2, 2014 v1.3.1 Aug 21, 2014 Changes in this version + const DefaultMaxHeaderBytes + const DefaultMaxIdleConnsPerHost + const StatusAccepted + const StatusBadGateway + const StatusBadRequest + const StatusConflict + const StatusContinue + const StatusCreated + const StatusExpectationFailed + const StatusForbidden + const StatusFound + const StatusGatewayTimeout + const StatusGone + const StatusHTTPVersionNotSupported + const StatusInternalServerError + const StatusLengthRequired + const StatusMethodNotAllowed + const StatusMovedPermanently + const StatusMultipleChoices + const StatusNoContent + const StatusNonAuthoritativeInfo + const StatusNotAcceptable + const StatusNotFound + const StatusNotImplemented + const StatusNotModified + const StatusOK + const StatusPartialContent + const StatusPaymentRequired + const StatusPreconditionFailed + const StatusProxyAuthRequired + const StatusRequestEntityTooLarge + const StatusRequestTimeout + const StatusRequestURITooLong + const StatusRequestedRangeNotSatisfiable + const StatusResetContent + const StatusSeeOther + const StatusServiceUnavailable + const StatusSwitchingProtocols + const StatusTeapot + const StatusTemporaryRedirect + const StatusUnauthorized + const StatusUnsupportedMediaType + const StatusUseProxy + const TimeFormat + var DefaultClient = &Client + var DefaultServeMux = NewServeMux() + var ErrBodyNotAllowed = errors.New("http: request method or response status code does not allow body") + var ErrBodyReadAfterClose = errors.New("http: invalid Read on closed Body") + var ErrContentLength = errors.New("Conn.Write wrote more than the declared Content-Length") + var ErrHandlerTimeout = errors.New("http: Handler timeout") + var ErrHeaderTooLong = &ProtocolError + var ErrHijacked = errors.New("Conn has been hijacked") + var ErrLineTooLong = errors.New("header line too long") + var ErrMissingBoundary = &ProtocolError + var ErrMissingContentLength = &ProtocolError + var ErrMissingFile = errors.New("http: no such file") + var ErrNoCookie = errors.New("http: named cookie not present") + var ErrNoLocation = errors.New("http: no Location header in response") + var ErrNotMultipart = &ProtocolError + var ErrNotSupported = &ProtocolError + var ErrShortBody = &ProtocolError + var ErrUnexpectedTrailer = &ProtocolError + var ErrWriteAfterFlush = errors.New("Conn.Write called after Flush") + func CanonicalHeaderKey(s string) string + func DetectContentType(data []byte) string + func Error(w ResponseWriter, error string, code int) + func Handle(pattern string, handler Handler) + func HandleFunc(pattern string, handler func(ResponseWriter, *Request)) + func ListenAndServe(addr string, handler Handler) error + func ListenAndServeTLS(addr string, certFile string, keyFile string, handler Handler) error + func MaxBytesReader(w ResponseWriter, r io.ReadCloser, n int64) io.ReadCloser + func NotFound(w ResponseWriter, r *Request) + func ParseHTTPVersion(vers string) (major, minor int, ok bool) + func ParseTime(text string) (t time.Time, err error) + func ProxyFromEnvironment(req *Request) (*url.URL, error) + func ProxyURL(fixedURL *url.URL) func(*Request) (*url.URL, error) + func Redirect(w ResponseWriter, r *Request, urlStr string, code int) + func Serve(l net.Listener, handler Handler) error + func ServeContent(w ResponseWriter, req *Request, name string, modtime time.Time, ...) + func ServeFile(w ResponseWriter, r *Request, name string) + func SetCookie(w ResponseWriter, cookie *Cookie) + func StatusText(code int) string + type Client struct + CheckRedirect func(req *Request, via []*Request) error + Jar CookieJar + Timeout time.Duration + Transport RoundTripper + func (c *Client) Do(req *Request) (resp *Response, err error) + func (c *Client) Get(url string) (resp *Response, err error) + func (c *Client) Head(url string) (resp *Response, err error) + func (c *Client) Post(url string, bodyType string, body io.Reader) (resp *Response, err error) + func (c *Client) PostForm(url string, data url.Values) (resp *Response, err error) + type CloseNotifier interface + CloseNotify func() <-chan bool + type ConnState int + const StateActive + const StateClosed + const StateHijacked + const StateIdle + const StateNew + func (c ConnState) String() string + type Cookie struct + Domain string + Expires time.Time + HttpOnly bool + MaxAge int + Name string + Path string + Raw string + RawExpires string + Secure bool + Unparsed []string + Value string + func (c *Cookie) String() string + type CookieJar interface + Cookies func(u *url.URL) []*Cookie + SetCookies func(u *url.URL, cookies []*Cookie) + type Dir string + func (d Dir) Open(name string) (File, error) + type File interface + Readdir func(count int) ([]os.FileInfo, error) + Seek func(offset int64, whence int) (int64, error) + Stat func() (os.FileInfo, error) + type FileSystem interface + Open func(name string) (File, error) + type Flusher interface + Flush func() + type Handler interface + ServeHTTP func(ResponseWriter, *Request) + func FileServer(root FileSystem) Handler + func NotFoundHandler() Handler + func RedirectHandler(url string, code int) Handler + func StripPrefix(prefix string, h Handler) Handler + func TimeoutHandler(h Handler, dt time.Duration, msg string) Handler + type HandlerFunc func(ResponseWriter, *Request) + func (f HandlerFunc) ServeHTTP(w ResponseWriter, r *Request) + type Header map[string][]string + func (h Header) Add(key, value string) + func (h Header) Del(key string) + func (h Header) Get(key string) string + func (h Header) Set(key, value string) + func (h Header) Write(w io.Writer) error + func (h Header) WriteSubset(w io.Writer, exclude map[string]bool) error + type Hijacker interface + Hijack func() (net.Conn, *bufio.ReadWriter, error) + type ProtocolError struct + ErrorString string + func (err *ProtocolError) Error() string + type Request struct + Body io.ReadCloser + Close bool + ContentLength int64 + Form url.Values + Header Header + Host string + Method string + MultipartForm *multipart.Form + PostForm url.Values + Proto string + ProtoMajor int + ProtoMinor int + RemoteAddr string + RequestURI string + TLS *tls.ConnectionState + Trailer Header + TransferEncoding []string + URL *url.URL + func NewRequest(method, urlStr string, body io.Reader) (*Request, error) + func ReadRequest(b *bufio.Reader) (req *Request, err error) + func (r *Request) AddCookie(c *Cookie) + func (r *Request) Cookie(name string) (*Cookie, error) + func (r *Request) Cookies() []*Cookie + func (r *Request) FormFile(key string) (multipart.File, *multipart.FileHeader, error) + func (r *Request) FormValue(key string) string + func (r *Request) MultipartReader() (*multipart.Reader, error) + func (r *Request) ParseForm() error + func (r *Request) ParseMultipartForm(maxMemory int64) error + func (r *Request) PostFormValue(key string) string + func (r *Request) ProtoAtLeast(major, minor int) bool + func (r *Request) Referer() string + func (r *Request) SetBasicAuth(username, password string) + func (r *Request) UserAgent() string + func (r *Request) Write(w io.Writer) error + func (r *Request) WriteProxy(w io.Writer) error + type Response struct + Body io.ReadCloser + Close bool + ContentLength int64 + Header Header + Proto string + ProtoMajor int + ProtoMinor int + Request *Request + Status string + StatusCode int + TLS *tls.ConnectionState + Trailer Header + TransferEncoding []string + func Get(url string) (resp *Response, err error) + func Head(url string) (resp *Response, err error) + func Post(url string, bodyType string, body io.Reader) (resp *Response, err error) + func PostForm(url string, data url.Values) (resp *Response, err error) + func ReadResponse(r *bufio.Reader, req *Request) (*Response, error) + func (r *Response) Cookies() []*Cookie + func (r *Response) Location() (*url.URL, error) + func (r *Response) ProtoAtLeast(major, minor int) bool + func (r *Response) Write(w io.Writer) error + type ResponseWriter interface + Header func() Header + Write func([]byte) (int, error) + WriteHeader func(int) + type RoundTripper interface + RoundTrip func(*Request) (*Response, error) + var DefaultTransport RoundTripper = &Transport{ ... } + func NewFileTransport(fs FileSystem) RoundTripper + type ServeMux struct + func NewServeMux() *ServeMux + func (mux *ServeMux) Handle(pattern string, handler Handler) + func (mux *ServeMux) HandleFunc(pattern string, handler func(ResponseWriter, *Request)) + func (mux *ServeMux) Handler(r *Request) (h Handler, pattern string) + func (mux *ServeMux) ServeHTTP(w ResponseWriter, r *Request) + type Server struct + Addr string + ConnState func(net.Conn, ConnState) + ErrorLog *log.Logger + Handler Handler + MaxHeaderBytes int + ReadTimeout time.Duration + TLSConfig *tls.Config + TLSNextProto map[string]func(*Server, *tls.Conn, Handler) + WriteTimeout time.Duration + func (s *Server) SetKeepAlivesEnabled(v bool) + func (srv *Server) ListenAndServe() error + func (srv *Server) ListenAndServeTLS(certFile, keyFile string) error + func (srv *Server) Serve(l net.Listener) error + type Transport struct + Dial func(network, addr string) (net.Conn, error) + DisableCompression bool + DisableKeepAlives bool + MaxIdleConnsPerHost int + Proxy func(*Request) (*url.URL, error) + ResponseHeaderTimeout time.Duration + TLSClientConfig *tls.Config + TLSHandshakeTimeout time.Duration + func (t *Transport) CancelRequest(req *Request) + func (t *Transport) CloseIdleConnections() + func (t *Transport) RegisterProtocol(scheme string, rt RoundTripper) + func (t *Transport) RoundTrip(req *Request) (resp *Response, err error)