platform/packages/route/test/uri_decode_test.dart

19 lines
464 B
Dart
Raw Normal View History

2021-05-14 07:02:50 +00:00
import 'package:angel3_route/angel3_route.dart';
2017-11-18 05:29:08 +00:00
import 'package:test/test.dart';
void main() {
test('uri params decoded', () {
2019-11-28 17:40:32 +00:00
var router = Router()..get('/a/:a/b/:b', '');
2017-11-18 05:29:08 +00:00
var encoded =
2022-08-17 03:21:47 +00:00
'/a/${Uri.encodeComponent('<<<')}/b/${Uri.encodeComponent('???')}';
2017-11-18 05:29:08 +00:00
print(encoded);
2017-11-25 00:26:06 +00:00
var result = router.resolveAbsolute(encoded).first;
2017-11-18 05:29:08 +00:00
print(result.allParams);
expect(result.allParams, {
'a': '<<<',
'b': '???',
});
});
}