content_length_validator 1.0.0 copy "content_length_validator: ^1.0.0" to clipboard
content_length_validator: ^1.0.0 copied to clipboard

outdated

Middleware for Shelf and Dart Frog to block too large requests.

example/content_length_validator_example.dart

// ignore_for_file: avoid_print

import 'package:content_length_validator/content_length_validator.dart';
import 'package:shelf/shelf.dart';
import 'package:shelf/shelf_io.dart' as shelf_io;

void main() async {
  final handler = const Pipeline()
      .addMiddleware(maxContentLengthValidator())
      .addMiddleware(logRequests())
      .addHandler(_echoRequest);

  final server = await shelf_io.serve(handler, 'localhost', 8080);

  // Enable content compression
  server.autoCompress = true;

  print('Serving at http://${server.address.host}:${server.port}');
}

Response _echoRequest(Request request) =>
    Response.ok('Request for "${request.url}"');
6
likes
0
pub points
53%
popularity

Publisher

verified publisherjxstxn.dev

Middleware for Shelf and Dart Frog to block too large requests.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

shelf

More

Packages that depend on content_length_validator