Documentation ¶
Index ¶
Constants ¶
View Source
const ( ForwardedHeader = "Forwarded" XForwardedHostHeader = "X-Forwarded-Host" XForwardedProtoHeader = "X-Forwarded-Proto" )
Variables ¶
This section is empty.
Functions ¶
func RequestBaseURL ¶
RequestBaseURL returns the base URL of the request. It prioritizes forwarded proxy headers.
func Write ¶
func Write(rw http.ResponseWriter, status int, response interface{})
Write outputs a standardized format to an HTTP response body.
func WriteBytes ¶
func WriteBytes(rw http.ResponseWriter, status int, bytes []byte)
WriteBytes tries to write the provided bytes and errors if unable.
Types ¶
type ErrorResponse ¶
type StatusWriter ¶
type StatusWriter struct { http.ResponseWriter Status int Hijacked bool // contains filtered or unexported fields }
StatusWriter intercepts the status of the request and the response body up to maxBodySize if Status >= 400. It is guaranteed to be the ResponseWriter directly downstream from Middleware.
func (*StatusWriter) Hijack ¶
func (w *StatusWriter) Hijack() (net.Conn, *bufio.ReadWriter, error)
func (*StatusWriter) ResponseBody ¶
func (w *StatusWriter) ResponseBody() []byte
func (*StatusWriter) WriteHeader ¶
func (w *StatusWriter) WriteHeader(status int)
Click to show internal directories.
Click to hide internal directories.