Skip to content

Commit 54a2f9a

Browse files
committed
use regexp in multiparam test
1 parent b4efb54 commit 54a2f9a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pkgs/shelf_router/test/router_test.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -262,16 +262,16 @@ void main() {
262262

263263
test('can mount dynamic routes with multiple parameters', () async {
264264
var app = Router();
265-
app.mount(r'/first/<second>/third/<fourth>/last',
266-
(Request request, String second, String fourth) {
265+
app.mount(r'/first/<second>/third/<fourth|\d+>/last',
266+
(Request request, String second, String fourthNum) {
267267
var router = Router();
268-
router.get('/', (r) => Response.ok('$second $fourth'));
268+
router.get('/', (r) => Response.ok('$second ${int.parse(fourthNum)}'));
269269
return router(request);
270270
});
271271

272272
server.mount(app);
273273

274-
expect(await get('/first/hello/third/bye/last'), 'hello bye');
274+
expect(await get('/first/hello/third/12/last'), 'hello 12');
275275
});
276276

277277
test('can mount dynamic routes with regexp', () async {

0 commit comments

Comments
 (0)