modulepackage
0.0.0-20211122204940-3aa76b92aec7
Repository: https://github.com/czarsimon/httputil.git
Documentation: pkg.go.dev
# Packages
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Functions
AllowContentType whitelists a given list of content types.
AllowJSON only allowes request with content type json.
BadGatewayError creates a 502 - Bad Gateway error.
BadGatewayf creates a 502 - Bad Gateway error.
BadRequestError creates a 400 - Bad Request error.
BadRequestf creates a 400 - Bad Request error.
ConflictError creates a 409 - Conflict error.
Conflictf creates a 409 - Conflict error.
Errorf creates a formated http error.
ForbiddenError creates a 403 - Forbidden error.
Forbiddenf creates a 403 - Forbidden error.
GetPrincipal returns the authenticated user if exists.
HandleErrors wrapper function to deal with encountered errors during request handling.
InternalServerError creates a 500 - Internal Server Error.
InternalServerErrorf creates a 500 - Internal Server Error.
Logger request logging middleware.
MethodNotAllowedError creates a 405 - Method Not Allowed error.
MethodNotAllowedf creates a 405 - Method Not Allowed error.
Metrics records metrics about a request.
MustGetPrincipal returns the authenticated user or an error if none exists.
NewCustomRouter creates a new router with a custom list of base middlewares.
NewError creates a new Error based on a supplied status code attempts to derive the error message.
NewRBAC creates a new RBAC struct with sane defaults.
NewRouter creates a default router.
NotFoundError creates a 404 - Not Found error.
NotFoundf creates a 404 - Not Found error.
NotImplementedError creates a 501 - Not Implemented error.
NotImplementedf creates a 501 - Not Implemented error.
ParseQueryValue parses a query value from request.
ParseQueryValues parses query values from a request.
PreconditionRequiredError creates a 428 - Precondition Required error.
PreconditionRequiredf creates a 428 - Precondition Required error.
RequestID ensures that a request contains a request id.
SendOK sends an ok status and message to the client.
ServiceUnavailableError creates a 503 - Service Unavailable error.
ServiceUnavailablef creates a 503 - Service Unavailable error.
TooManyRequestsError creates a 429 - Too Many Requests error.
TooManyRequestsf creates a 429 - Too Many Requests error.
Trace captures open tracing span and attaches it to the request context.
UnauthorizedError creates a 401 - Unauthorized error.
Unauthorizedf creates a 401 - Unauthorized error.
UnsupportedMediaTypeError creates a 415 - Unsupported Media Type error.
UnsupportedMediaTypef creates a 415 - Unsupported Media Type error.
# Constants
Common tracing headers.
Common tracing headers.
Common tracing headers.
# Type aliases
HealthFunc health check function signature.