response

package
v0.0.0-...-be21ac7 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2015 License: MIT Imports: 4 Imported by: 0

README

response

HTTP response utilities.

View the docs.

response.Pretty = false
response.JSON(w, user)
response.XML(w, user)
response.NotFound(w)
response.Unauthorized(w)
response.Unauthorized(w, "sorry!")
response.Unauthorized(w, map[string]string{"whatever": "here"})

Provides

  • JSON responses
  • XML responses
  • Error responses
  • Status code responses
  • Toggling of "pretty" responses

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Pretty = true

Pretty response formatting.

Functions

func Accepted

func Accepted(w http.ResponseWriter, msg ...interface{})

Accepted response.

func BadGateway

func BadGateway(w http.ResponseWriter, msg ...interface{})

BadGateway response.

func BadRequest

func BadRequest(w http.ResponseWriter, msg ...interface{})

BadRequest response.

func Conflict

func Conflict(w http.ResponseWriter, msg ...interface{})

Conflict response.

func Continue

func Continue(w http.ResponseWriter, msg ...interface{})

Continue response.

func Created

func Created(w http.ResponseWriter, msg ...interface{})

Created response.

func Error

func Error(w http.ResponseWriter, code int)

Error responds with a generic status code response.

func ExpectationFailed

func ExpectationFailed(w http.ResponseWriter, msg ...interface{})

ExpectationFailed response.

func Forbidden

func Forbidden(w http.ResponseWriter, msg ...interface{})

Forbidden response.

func Found

func Found(w http.ResponseWriter, msg ...interface{})

Found response.

func GatewayTimeout

func GatewayTimeout(w http.ResponseWriter, msg ...interface{})

GatewayTimeout response.

func Gone

func Gone(w http.ResponseWriter, msg ...interface{})

Gone response.

func HTTPVersionNotSupported

func HTTPVersionNotSupported(w http.ResponseWriter, msg ...interface{})

HTTPVersionNotSupported response.

func InternalServerError

func InternalServerError(w http.ResponseWriter, msg ...interface{})

InternalServerError response.

func JSON

func JSON(w http.ResponseWriter, val interface{}, code ...int)

JSON response with optional status code.

func LengthRequired

func LengthRequired(w http.ResponseWriter, msg ...interface{})

LengthRequired response.

func MethodNotAllowed

func MethodNotAllowed(w http.ResponseWriter, msg ...interface{})

MethodNotAllowed response.

func MovedPermanently

func MovedPermanently(w http.ResponseWriter, msg ...interface{})

MovedPermanently response.

func MultipleChoices

func MultipleChoices(w http.ResponseWriter, msg ...interface{})

MultipleChoices response.

func NoContent

func NoContent(w http.ResponseWriter, msg ...interface{})

NoContent response.

func NonAuthoritativeInfo

func NonAuthoritativeInfo(w http.ResponseWriter, msg ...interface{})

NonAuthoritativeInfo response.

func NotAcceptable

func NotAcceptable(w http.ResponseWriter, msg ...interface{})

NotAcceptable response.

func NotFound

func NotFound(w http.ResponseWriter, msg ...interface{})

NotFound response.

func NotImplemented

func NotImplemented(w http.ResponseWriter, msg ...interface{})

NotImplemented response.

func NotModified

func NotModified(w http.ResponseWriter, msg ...interface{})

NotModified response.

func OK

func OK(w http.ResponseWriter, msg ...interface{})

OK response.

func PartialContent

func PartialContent(w http.ResponseWriter, msg ...interface{})

PartialContent response.

func PaymentRequired

func PaymentRequired(w http.ResponseWriter, msg ...interface{})

PaymentRequired response.

func PreconditionFailed

func PreconditionFailed(w http.ResponseWriter, msg ...interface{})

PreconditionFailed response.

func ProxyAuthRequired

func ProxyAuthRequired(w http.ResponseWriter, msg ...interface{})

ProxyAuthRequired response.

func RequestEntityTooLarge

func RequestEntityTooLarge(w http.ResponseWriter, msg ...interface{})

RequestEntityTooLarge response.

func RequestTimeout

func RequestTimeout(w http.ResponseWriter, msg ...interface{})

RequestTimeout response.

func RequestURITooLong

func RequestURITooLong(w http.ResponseWriter, msg ...interface{})

RequestURITooLong response.

func RequestedRangeNotSatisfiable

func RequestedRangeNotSatisfiable(w http.ResponseWriter, msg ...interface{})

RequestedRangeNotSatisfiable response.

func ResetContent

func ResetContent(w http.ResponseWriter, msg ...interface{})

ResetContent response.

func SeeOther

func SeeOther(w http.ResponseWriter, msg ...interface{})

SeeOther response.

func ServiceUnavailable

func ServiceUnavailable(w http.ResponseWriter, msg ...interface{})

ServiceUnavailable response.

func SwitchingProtocols

func SwitchingProtocols(w http.ResponseWriter, msg ...interface{})

SwitchingProtocols response.

func Teapot

func Teapot(w http.ResponseWriter, msg ...interface{})

Teapot response.

func TemporaryRedirect

func TemporaryRedirect(w http.ResponseWriter, msg ...interface{})

TemporaryRedirect response.

func Unauthorized

func Unauthorized(w http.ResponseWriter, msg ...interface{})

Unauthorized response.

func UnsupportedMediaType

func UnsupportedMediaType(w http.ResponseWriter, msg ...interface{})

UnsupportedMediaType response.

func UseProxy

func UseProxy(w http.ResponseWriter, msg ...interface{})

UseProxy response.

func XML

func XML(w http.ResponseWriter, val interface{}, code ...int)

XML response with optional status code.

Types

This section is empty.

Jump to

Keyboard shortcuts

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