Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrAlreadySent = sdk.Errorf("brock/sdkhttp: already sent to the client") ErrAlreadyStreamed = sdk.Errorf("brock/sdkhttp: already streamed to the client") ErrUnimplemented = sdk.Errorf("brock/sdkhttp: unimplemented") )
View Source
var Body body
View Source
var Header header
View Source
var MultipartForm multipartForm
View Source
var Query query
View Source
var Request request
View Source
var Wrap wrap
Functions ¶
func NamedArgsFromRequest ¶
NamedArgsFromRequest is a helper function that extract url.Values that have been parsed using MuxMatcherPattern, url.Values should not be empty if parsing is successful and should be able to extract further following url.Values, same keys in the pattern result in new value added in url.Values.
func PanicRecoveryFromRequest ¶
PanicRecoveryFromRequest is a helper function that extract error value when panic occurred, the value is saved to *http.Request after recovery process and right before calling mux.PanicHandler.
Types ¶
type WrapHandler ¶
type WrapHandler interface { // Err get any error passed from the previous handler Err() error // Next pass the error to the next handler Next(err error) // Send is a shorthand for set the statusCode, header & body Send(statusCode int, header http.Header, body io.Reader) (int, error) // Stream is used for streaming response to the client Stream(p []byte) (int, error) // H2Push initiate a HTTP/2 server push H2Push(target, method string, header http.Header) error }
WrapHandler helper contract.
Click to show internal directories.
Click to hide internal directories.