Documentation ¶
Overview ¶
Package xhttp provides HTTP-related utilities.
Index ¶
- func WriteHTTPStatus(w http.ResponseWriter, statusCode int)
- type BasicAuth
- type PasswordLookup
- type StatusResponseWriter
- func (w *StatusResponseWriter) BytesWritten() int
- func (w *StatusResponseWriter) Flush()
- func (w *StatusResponseWriter) Header() http.Header
- func (w *StatusResponseWriter) Status() int
- func (w *StatusResponseWriter) Write(data []byte) (int, error)
- func (w *StatusResponseWriter) WriteHeader(status int)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WriteHTTPStatus ¶
func WriteHTTPStatus(w http.ResponseWriter, statusCode int)
WriteHTTPStatus sends an HTTP response header with 'statusCode' and follows it with the standard text for that code as the body.
Types ¶
type BasicAuth ¶
type BasicAuth struct {
// contains filtered or unexported fields
}
BasicAuth provides basic HTTP authentication.
func NewBasicAuth ¶
func NewBasicAuth(realm string, lookup PasswordLookup) *BasicAuth
NewBasicAuth creates a new BasicAuth.
type PasswordLookup ¶
PasswordLookup provides a way to map a user in a realm to a password
type StatusResponseWriter ¶
type StatusResponseWriter struct { Original http.ResponseWriter Head bool // contains filtered or unexported fields }
StatusResponseWriter wraps an http.ResponseWriter and provides methods to retrieve the status code and number of bytes written.
func (*StatusResponseWriter) BytesWritten ¶
func (w *StatusResponseWriter) BytesWritten() int
BytesWritten returns the number of bytes written.
func (*StatusResponseWriter) Flush ¶
func (w *StatusResponseWriter) Flush()
Flush implements http.Flusher.
func (*StatusResponseWriter) Header ¶
func (w *StatusResponseWriter) Header() http.Header
Header implements http.ResponseWriter.
func (*StatusResponseWriter) Status ¶
func (w *StatusResponseWriter) Status() int
Status returns the status that was set, or http.StatusOK if no call to WriteHeader() was made.
func (*StatusResponseWriter) Write ¶
func (w *StatusResponseWriter) Write(data []byte) (int, error)
Write implements http.ResponseWriter.
func (*StatusResponseWriter) WriteHeader ¶
func (w *StatusResponseWriter) WriteHeader(status int)
WriteHeader implements http.ResponseWriter.