Route.json constructor

Route.json(
  1. String path,
  2. RouteHandler handler,
  3. {List<String> methods = const <String>['GET', 'PUT', 'POST', 'DELETE'],
  4. Map<String, String>? pathRegEx,
  5. int? statusCode,
  6. String? mimeType,
  7. String? charset = kDefaultCharset,
  8. ResponseProcessor? responseProcessor = jsonResponseProcessor,
  9. List<RouteInterceptor>? after,
  10. List<RouteInterceptor>? before,
  11. List<ExceptionHandler>? onException}
)

Constructs a Route for JSON requests

Implementation

factory Route.json(String path, RouteHandler handler,
        {List<String> methods = const <String>[
          'GET',
          'PUT',
          'POST',
          'DELETE'
        ],
        Map<String, String>? pathRegEx,
        int? statusCode,
        String? mimeType,
        String? charset = kDefaultCharset,
        ResponseProcessor? responseProcessor = jsonResponseProcessor,
        List<RouteInterceptor>? after,
        List<RouteInterceptor>? before,
        List<ExceptionHandler>? onException}) =>
    Route.fromInfo(
        HttpMethod(
            methods: methods,
            path: path,
            pathRegEx: pathRegEx,
            statusCode: statusCode,
            mimeType: mimeType,
            charset: charset,
            responseProcessor: responseProcessor),
        handler,
        before: before,
        after: after,
        onException: onException);