Documentation ¶
Index ¶
- func BasicAuth(r *http.Request) (username, password string, ok bool)
- func Cacheable(hdr http.Header) (time.Duration, bool, error)
- func CopyRequest(r *http.Request) *http.Request
- func MergeQuery(u url.URL, q url.Values) url.URL
- func NewResourceLocation(reqURL *url.URL, id string) string
- func ParseNonEmptyURL(u string) (*url.URL, error)
- func WriteError(w http.ResponseWriter, code int, msg string)
- type Client
- type LoggingMiddleware
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BasicAuth ¶
BasicAuth parses a username and password from the request's Authorization header. This was pulled from golang master: https://codereview.appspot.com/76540043
func CopyRequest ¶
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 ¶
MergeQuery appends additional query values to an existing URL.
func NewResourceLocation ¶
NewResourceLocation appends a resource id to the end of the requested URL path.
func ParseNonEmptyURL ¶
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 LoggingMiddleware ¶
func (*LoggingMiddleware) ServeHTTP ¶
func (l *LoggingMiddleware) ServeHTTP(w http.ResponseWriter, r *http.Request)
Click to show internal directories.
Click to hide internal directories.