Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/dart_frog/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 1.2.6

- fix: revert `Expando` perf optimization ([#1908](https://github.com/dart-frog-dev/dart_frog/pull/1908))

Check warning on line 3 in packages/dart_frog/CHANGELOG.md

View workflow job for this annotation

GitHub Actions / spell-check / build

Unknown word (Expando)
- perf optimization caused a regression when calling `request.read` multiple times across a middleware/handler gap

# 1.2.5

- feat: add `defaultDocument` to `createStaticFileHandler` ([#1901](https://github.com/dart-frog-dev/dart_frog/pull/1901))
Expand Down
2 changes: 1 addition & 1 deletion packages/dart_frog/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: dart_frog
description: The official runtime for Dart Frog — a fast, minimalistic backend framework for Dart.
version: 1.2.5
version: 1.2.6
homepage: https://dart-frog.dev
repository: https://github.com/dart-frog-dev/dart_frog
issue_tracker: https://github.com/dart-frog-dev/dart_frog/issues
Expand Down
31 changes: 31 additions & 0 deletions packages/dart_frog/test/src/serve_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -254,5 +254,36 @@ SFTrELxay/xfdivEUxK9wEIG
throwsA(isA<HandshakeException>()),
);
});

test('can read request.body across middleware:handler gap', () async {
Middleware middleware() {
return (handler) {
return (context) async {
await context.request.body();
return handler(context);
};
};
}

Handler handler() {
return (context) async {
await context.request.body();
return Response();
};
}

final pipeline = const Pipeline().addMiddleware(middleware());
final router = Router()..mount('/', handler());
final server = await serve(
pipeline.addHandler(router.call),
'localhost',
3000,
);
final client = HttpClient();
final request = await client.getUrl(Uri.parse('http://localhost:3000'));
final response = await request.close();
expect(response.statusCode, equals(HttpStatus.ok));
await server.close();
});
});
}
Loading