Package http implements the basic pace microservice handlers and a standard microservice server configured via environment variables.
All exported package errors.
ContextTransfer copies a request representation from one context to another.
Environment returns the name of the current server environment
GetUserAgentFromContext returns the User-Agent header value from the request that is stored in the context. Returns ErrNotFound if the context does not have a request.
GetXForwardedForHeaderFromContext returns the X-Forwarded-For header value that would express that you forwarded the request that is stored in the context.
If the remote address of the request is 184.108.40.206:9999 then the value is that remote ip without the port. If the request already includes this header, the remote ip is appended to the value of that header. For example if the request on top of the remote ip also includes the header "X-Forwarded-For: 100.100.100.100" then the resulting value is "100.100.100.100, 220.127.116.11".
Returns ErrNotFound if the context does not have a request. Returns ErrInvalidRequest if the request in the context is malformed, for example because it does not have a remote address, which should never happen.
JsonApiErrorWriterMiddleware is a middleware that wraps http.ResponseWriter such that it forces responses with status codes 4xx/5xx to have Content-Type: application/vnd.api+json
RequestInContextMiddleware stores a representation of the request in the context of said request. Some information of that request can then be accessed through the context using functions of this package.
Router returns the default microservice endpoints for health, metrics and debugging
Server returns a http.Server configured using environment variables, following https://12factor.net/.
|jsonapi||Package jsonapi provides a serializer and deserializer for jsonapi.org spec payloads.|
|jsonapi/generator||Package generator translates an OpenAPIv3 specification into working go code that handles marshalling, error handling, parameter parsing and validation.|
|jsonapi/runtime||Package runtime contains functions for marshalling, error handling, parameter parsing and validation.|
|oauth2||Package oauth2 provides a middelware that introspects the auth token on behalf of PACE services and populate the request context with useful information when the token is valid, otherwise aborts the request.|