glimr/http/middleware/expects_json

Expects JSON Middleware

Sets the response format to JSON and configures the error handler to return JSON error responses. Place this at the start of your API middleware group so all downstream middleware and handlers know responses should be JSON.

Values

pub fn run(
  ctx: context.Context(app),
  next: fn(context.Context(app)) -> response.Response(wisp.Body),
) -> response.Response(wisp.Body)

Sets the response format to JSON for this request and wraps the handler with JSON error responses.

Search Document