Documentation
¶
Index ¶
- Constants
- Variables
- func BlobResponse(w http.ResponseWriter, status int, contentType string, b []byte) error
- func FormResponse(w http.ResponseWriter, status int, value interface{}) error
- func IP(req *http.Request) string
- func JSONResponse(w http.ResponseWriter, status int, value interface{}) error
- func MarshalForm(v interface{}) ([]byte, error)
- func NewHandler(method string, h http.Handler) http.Handler
- func NewHandlerFunc(method string, h http.HandlerFunc) http.Handler
- func Response(w http.ResponseWriter, status int, acceptType string, value interface{}) error
- func ResponseWithMarshaler(w http.ResponseWriter, status int, contentType string, value interface{}, ...) error
- func TextResponse(w http.ResponseWriter, status int, value string) error
- func XMLResponse(w http.ResponseWriter, status int, value interface{}) error
- type FormMarshaler
- type HandlerConnect
- type HandlerDelete
- type HandlerGet
- type HandlerHead
- type HandlerMatcher
- type HandlerOptions
- type HandlerPatch
- type HandlerPost
- type HandlerPut
- type HandlerTrace
- type MarshalFunc
- type MarshalIndentFunc
- type Result
- type ServeMux
Constants ¶
View Source
const ( MIMEApplicationJSON = "application/json" MIMEApplicationJSONCharsetUTF8 = MIMEApplicationJSON + "; " + charsetUTF8 MIMEApplicationJavaScript = "application/javascript" MIMEApplicationJavaScriptCharsetUTF8 = MIMEApplicationJavaScript + "; " + charsetUTF8 MIMEApplicationXML = "application/xml" MIMEApplicationXMLCharsetUTF8 = MIMEApplicationXML + "; " + charsetUTF8 MIMEApplicationForm = "application/x-www-form-urlencoded" MIMEApplicationProtobuf = "application/protobuf" MIMEApplicationMsgpack = "application/msgpack" MIMETextHTML = "text/html" MIMETextHTMLCharsetUTF8 = MIMETextHTML + "; " + charsetUTF8 MIMETextPlain = "text/plain" MIMETextPlainCharsetUTF8 = MIMETextPlain + "; " + charsetUTF8 MIMEMultipartForm = "multipart/form-data" MIMEOctetStream = "application/octet-stream" )
View Source
const ( HeaderAccept = "Accept" HeaderAcceptEncoding = "Accept-Encoding" HeaderAllow = "Allow" HeaderAuthorization = "Authorization" HeaderContentDisposition = "Content-Disposition" HeaderContentEncoding = "Content-Encoding" HeaderContentLength = "Content-Length" HeaderContentType = "Content-Type" HeaderCookie = "Cookie" HeaderSetCookie = "Set-Cookie" HeaderIfModifiedSince = "If-Modified-Since" HeaderLastModified = "Last-Modified" HeaderLocation = "Location" HeaderUpgrade = "Upgrade" HeaderVary = "Vary" HeaderWWWAuthenticate = "WWW-Authenticate" HeaderXForwardedProto = "X-Forwarded-Proto" HeaderXHTTPMethodOverride = "X-HTTP-Method-Override" HeaderXForwardedFor = "X-Forwarded-For" HeaderXRealIP = "X-Real-IP" HeaderServer = "Server" HeaderOrigin = "Origin" HeaderAccessControlRequestMethod = "Access-Control-Request-Method" HeaderAccessControlRequestHeaders = "Access-Control-Request-Headers" HeaderAccessControlAllowOrigin = "Access-Control-Allow-Origin" HeaderAccessControlAllowMethods = "Access-Control-Allow-Methods" HeaderAccessControlAllowHeaders = "Access-Control-Allow-Headers" HeaderAccessControlAllowCredentials = "Access-Control-Allow-Credentials" HeaderAccessControlExposeHeaders = "Access-Control-Expose-Headers" HeaderAccessControlMaxAge = "Access-Control-Max-Age" HeaderStrictTransportSecurity = "Strict-Transport-Security" HeaderXContentTypeOptions = "X-Content-Type-Options" HeaderXXSSProtection = "X-XSS-Protection" HeaderXFrameOptions = "X-Frame-Options" HeaderContentSecurityPolicy = "Content-Security-Policy" HeaderXCSRFToken = "X-CSRF-Token" )
Variables ¶
View Source
var (
ErrMissingRequiredArgument = errors.New("missing required argument")
)
View Source
var (
ErrUnableToMarshalForm = errors.New("unable to marshal form")
)
Functions ¶
func BlobResponse ¶
func FormResponse ¶
func FormResponse(w http.ResponseWriter, status int, value interface{}) error
func JSONResponse ¶
func JSONResponse(w http.ResponseWriter, status int, value interface{}) error
func MarshalForm ¶
func NewHandlerFunc ¶
func NewHandlerFunc(method string, h http.HandlerFunc) http.Handler
func Response ¶
func Response(w http.ResponseWriter, status int, acceptType string, value interface{}) error
func ResponseWithMarshaler ¶
func ResponseWithMarshaler( w http.ResponseWriter, status int, contentType string, value interface{}, marshal MarshalFunc, ) error
func TextResponse ¶
func TextResponse(w http.ResponseWriter, status int, value string) error
func XMLResponse ¶
func XMLResponse(w http.ResponseWriter, status int, value interface{}) error
Types ¶
type FormMarshaler ¶
type HandlerConnect ¶
type HandlerConnect struct{}
type HandlerDelete ¶
type HandlerDelete struct{}
type HandlerGet ¶
type HandlerGet struct{}
type HandlerHead ¶
type HandlerHead struct{}
type HandlerMatcher ¶
type HandlerOptions ¶
type HandlerOptions struct{}
type HandlerPatch ¶
type HandlerPatch struct{}
type HandlerPost ¶
type HandlerPost struct{}
type HandlerPut ¶
type HandlerPut struct{}
type HandlerTrace ¶
type HandlerTrace struct{}
type MarshalFunc ¶
Click to show internal directories.
Click to hide internal directories.