http

package
v1.3.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2016 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BasicAuth

func BasicAuth(r *http.Request) (username, password string, ok bool)

BasicAuth parses a username and password from the request's Authorization header. This was pulled from golang master: https://codereview.appspot.com/76540043

func Cacheable

func Cacheable(hdr http.Header) (time.Duration, bool, error)

func CopyRequest

func CopyRequest(r *http.Request) *http.Request

CopyRequest returns a clone of the provided *http.Request. The returned object is a shallow copy of the struct and a deep copy of its Header field.

func MergeQuery

func MergeQuery(u url.URL, q url.Values) url.URL

MergeQuery appends additional query values to an existing URL.

func NewResourceLocation

func NewResourceLocation(reqURL *url.URL, id string) string

NewResourceLocation appends a resource id to the end of the requested URL path.

func ParseNonEmptyURL

func ParseNonEmptyURL(u string) (*url.URL, error)

ParseNonEmptyURL checks that a string is a parsable URL which is also not empty since `url.Parse("")` does not return an error. Must contian a scheme and a host.

func WriteError

func WriteError(w http.ResponseWriter, code int, msg string)

Types

type Client

type Client interface {
	Do(*http.Request) (*http.Response, error)
}

type LoggingMiddleware

type LoggingMiddleware struct {
	Next http.Handler
}

func (*LoggingMiddleware) ServeHTTP

func (l *LoggingMiddleware) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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