Documentation ¶
Overview ¶
Package http is a library designed to make working with the HTTP transport easier for jenny servers.
Index ¶
Constants ¶
View Source
const ( // ContextKeyRequestMethod is populated in the context by // PopulateRequestContext. Its value is r.Method. ContextKeyRequestMethod contextKey = iota // ContextKeyRequestURI is populated in the context by // PopulateRequestContext. Its value is r.RequestURI. ContextKeyRequestURI // ContextKeyRequestURL is populated in the context by // PopulateRequestContext. Its value is r.RequestURI. ContextKeyRequestURL // ContextKeyRequestPath is populated in the context by // PopulateRequestContext. Its value is r.URL.Path. ContextKeyRequestPath // ContextKeyRequestProto is populated in the context by // PopulateRequestContext. Its value is r.Proto. ContextKeyRequestProto // ContextKeyRequestHost is populated in the context by // PopulateRequestContext. Its value is r.Host. ContextKeyRequestHost // ContextKeyRequestRemoteAddr is populated in the context by // PopulateRequestContext. Its value is r.RemoteAddr. ContextKeyRequestRemoteAddr // ContextKeyRequestXForwardedFor is populated in the context by // PopulateRequestContext. Its value is r.Header.Get("X-Forwarded-For"). ContextKeyRequestXForwardedFor // ContextKeyRequestXForwardedProto is populated in the context by // PopulateRequestContext. Its value is r.Header.Get("X-Forwarded-Proto"). ContextKeyRequestXForwardedProto // ContextKeyRequestAuthorization is populated in the context by // PopulateRequestContext. Its value is r.Header.Get("Authorization"). ContextKeyRequestAuthorization // ContextKeyRequestReferer is populated in the context by // PopulateRequestContext. Its value is r.Header.Get("Referer"). ContextKeyRequestReferer // ContextKeyRequestUserAgent is populated in the context by // PopulateRequestContext. Its value is r.Header.Get("User-Agent"). ContextKeyRequestUserAgent // ContextKeyRequestXRequestID is populated in the context by // PopulateRequestContext. Its value is r.Header.Get("X-Request-Id"). ContextKeyRequestXRequestID // ContextKeyRequestAccept is populated in the context by // PopulateRequestContext. Its value is r.Header.Get("Accept"). ContextKeyRequestAccept // ContextKeyResponseHeaders is populated in the context whenever a // ServerFinalizerFunc is specified. Its value is of type http.Header, and // is captured only once the entire response has been written. ContextKeyResponseHeaders // ContextKeyResponseSize is populated in the context whenever a // ServerFinalizerFunc is specified. Its value is of type int64. ContextKeyResponseSize // ContextKeyCookies is populated with the Request cookies ContextKeyCookies // ContextKeyID is the X-Debug-ID header ContextKeyID // ContextKeyAccepts is the Accept header ContextKeyAccepts // ConetxtKeyContentType is the X-Debug-ID header ConetxtKeyContentType // ContextKeyRequestHeaders is the request headers ContextKeyRequestHeaders // ContextKeyUserAgent is the UserAgent in request ContextKeyUserAgent )
Variables ¶
View Source
var ErrCouldntFindAccepts = errors.New("can't find accepts in header")
ErrCouldntFindAccepts is returned when Accept mimeTypes can't be found in the header
Functions ¶
func ContextAccepts ¶
ContextAccepts returns the accept specs if the request has been originated from a HTTP request
func ContextCookie ¶
ContextCookie return a cookie that was in the http.Request
func ContextRequestID ¶
ContextRequestID returns a unique id for the request
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.