- Added
hostto structured logging attributes. - Improved
schemein structured logging attributes to parseForwardedHTTP header.
- Added support for
jsonapilinksandmetafor list responses. - Upgraded to latest
github.com/hashicorp/jsonapipackage.
- Use github.com/google/go-cmp to test response body.
- Switch to standard
slogpackage for logging. - Added a
slog.Loggertohttp.Request.Context(). - Added a
slog.Loggertojson.Request.
- PanicMiddleware no longer writes response code (to avoid panic from duplicate write).
- PanicMiddleware prints stack trace to stderr.
- Configured
http.Serverwith no timeouts. - Added
AdjustServerFntoapi.Serverthat allows configuration of the underlyinghttp.Server.
- Added
errors.CaptureMiddlewareto report API errors. - Added macros to
errorsfor creating path/querystring/payload parse errors. - Added request parsers that automate parsing and error wrapping.
- Improved
recovery.PanicMiddlewareto injectPanicError(adheres toerror) instead ofinterface{}. PanicErrorcontains stack trace asStackTrace() []byte.- Added
jwt.ClaimsMiddleware[T]which retrieves JWT token from request, then parses the token into custom claims.
- Reimplemented
intercept.Middlewareto usehttpsnoop.
- Added
MiddlewareChainto create a set of middlewares without using a router. This is helpful to apply middleware to a single HTTP handler.
- Added
ErrorCodetoApiErrorto emit application-specific error codes. - Changed
BadRequestError.Detailsfrom[]stringtomap[string]string
- Added
errors.ObscureInteralErrorsMiddlewareto prevent sensitive errors from reaching users.- A developer can optionally log the original error message to logs.
- Refactor
ValidationErrorsto a slice for easier interaction. - Added helpers to
ValidationErrorsto swap between map and slice.
- Reporting json encoding errors to logs when sending json response.
- Fixed
ApiErrorfrom hiding injectedErr.
- Added
NewApiErrorandNewBadRequestErrorfor easier error construction.
- Improved formatting of
errors.BadRequestError.
- Added support for
errorspackage injsonapipackage.
- Aligned
SendError(error)injsonapipackage withjsonpackage.
- Added
captureBodytoggle onintercept.Middlewareto prevent capturing body if only intercepting status code/response duration.
- Added
http.Hijackerpass-through for all response writers (includingintercept.Middleware).
- Added
LaunchTLStoServer.
- Added
errorspackage for default error formats.
- Replace panic middleware with custom and added user-supplied fn.
- Fixed CORS preflight from responding with 405 (Method Not Allowed) when a route was not registered.
- Added
logging.FallbackBehavior.
- Fix busted go version.
- Replaced logging middleware with
intercept.Middlewareand logging macros.
- Fixed emission of errors through
jsonapiinterfaces.
- Added
jwt.Middleware()to parse, but not verify incoming jwt token inAuthorizationheader asBearertoken.
- Add
jsonapipackage to support JSONAPI.
- Fixed
EndpointGroupprefix.
- Added
EndpointGroupto locate several endpoints under a single prefixed path.
- Fixed bug in
AuthenticateMiddlewareprohibiting upstream proxying when error occurs.
- Added
authpackage withAuthenticateMiddlewareandAuthorizeMiddleware.
- Added support for
Access-Control-Allow-Credentialsfor cors middleware.- By default, this is set to
true
- By default, this is set to
- Amended endpoint logger to log outgoing data for 4xx, 5xx responses
- Providing default CORS setup that works properly
- Providing mechanism to flow NotFound and MethodNotAllowed through middlewares
- Setting up
app1example to log NotFound and MethodNotAllowed and utilize default CORS setup
- Added
standard.NewEnpointhelper to make concise syntax.
- Rebuilt entire library to be simpler and not obscure golang http constructs.
- Added
gzip,recoverymiddleware - Added
optionsendpoint
- BREAKING: Removed
Unlogged()from endpoints. - Added support for middleware
- Added endpoint logger to migrate endpoint logging to middleware.
- Added support for reading query string from request.
- Added
Raw.Endpoint, allowing ahttp.HandlerFuncto be used as anEndpoint.
- Added
Endpointswith a helperPrint.
- Added ability to not log requests to an endpoint. Useful for health endpoints that are repeatedly hit.
- Using t.Run to run tests.
- Rebuilt api server contextual wrapping.
- Fixed response header
Content-Typetoapplication/json.
- Refactoring logging of request.
FEATURES:
- Logging duration of request.
FEATURES:
- Initial implementation of go-api.
- Implemented json endpoints.