package
0.0.0-20240110134719-544aadceddba
Repository: https://github.com/ungerik/go-httpx.git
Documentation: pkg.go.dev
# Functions
AsError converts val to an error by either casting val to error if possible, or using its string value or String method as error message, or using fmt.Errorf("%+v", val) to format the value as error.
DefaultHandlerImpl checks if err unwraps to a http.Handler and calls its ServeHTTP method else it checks if err wrapped any key in SentinelHandlers and calls ServeHTTP of the http.Handler value.
DontLog wraps the passed error so that ShouldLog returns false.
No description provided by the author
No description provided by the author
Handle will call DefaultHandler.HandleError(err, writer, request).
HandlePanic will call DefaultHandler.HandleError(AsError(recoverResult), writer, request).
JSON returns a Response error that will respond with the passed statusCode, the content type application/json and the passed body marshalled as JSON.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
ShouldLog checks if the passed error has been wrapped with DontLog.
No description provided by the author
WriteAsJSON unmarshals err as JSON and writes it as application/json response body using the passed statusCode.
WriteHandler checks if err unwraps to a http.Handler and calls its ServeHTTP method else it checks if err wrapped any key in SentinelHandlers and calls ServeHTTP of the http.Handler value.
WriteInternalServerError writes err as 500 Internal Server Error reponse.
# Variables
400: RFC 7231, 6.5.1.
No description provided by the author
No description provided by the author
No description provided by the author
403: RFC 7231, 6.5.3.
405: RFC 7231, 6.5.5.
404: RFC 7231, 6.5.4.
402: RFC 7231, 6.5.2.
SentinelHandlers is used by DefaultHandlerImpl to map wrapped sentinel errors to corresponding http.Handler.
401: RFC 7235, 3.1.
# Type aliases
No description provided by the author