-
Notifications
You must be signed in to change notification settings - Fork 164
Closed
Labels
bugSomething isn't working as expectedSomething isn't working as expected
Milestone
Description
Description
Middlewares inside dynamic routes are not recognized.
Steps To Reproduce
- Create a frog server with the following route structure
routes/
- _middleware.dart
- [id]/
- index.dart
- _middleware.dart
- On the root middleware, put the following content:
import 'package:dart_frog/dart_frog.dart';
Handler middleware(Handler handler) {
return handler
.use(provider<String>((context) {
return 'root middleware haha';
}));
}
- On the middleware under
/[id]
, put the following content:
import 'package:dart_frog/dart_frog.dart';
Handler middleware(Handler handler) {
return handler
.use(provider<String>((context) {
return 'id middleware hihi';
}));
}
- On
/[id]/index.dart
put the following content:
import 'package:dart_frog/dart_frog.dart';
Response onRequest(RequestContext context) {
final thingy = context.read<String>();
return Response(body: 'result: $thingy');
}
- Start the server and go to
http://localhost:8080/someid
- See the result:
result: root middleware haha
Expected Behavior
The handler at /[id]/index.dart
should; receive a context with information for the closest middleware, not the root one.
Additional Context
Reproducible with the CLI version 0.0.2-dev.7
Metadata
Metadata
Assignees
Labels
bugSomething isn't working as expectedSomething isn't working as expected