xhttp

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2019 License: MPL-2.0 Imports: 2 Imported by: 1

Documentation

Overview

Package xhttp provides HTTP-related utilities.

Index

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.

func (*BasicAuth) Wrap

func (auth *BasicAuth) Wrap(handler http.Handler) http.Handler

Wrap an http.Handler.

type PasswordLookup

type PasswordLookup func(user string, realm string) string

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.

Directories

Path Synopsis
Package web provides a web server with some standardized logging and handler wrapping.
Package web provides a web server with some standardized logging and handler wrapping.

Jump to

Keyboard shortcuts

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