Upgraded package route
This commit is contained in:
parent
326d2d0c59
commit
cac3512416
2 changed files with 23 additions and 21 deletions
|
@ -1,10 +1,10 @@
|
|||
name: angel_route
|
||||
description: A powerful, isomorphic routing library for Dart. It is mainly used in the Angel framework, but can be used in Flutter and on the Web.
|
||||
version: 3.1.0+1
|
||||
version: 3.3.0
|
||||
author: Tobe O <thosakwe@gmail.com>
|
||||
homepage: https://github.com/angel-dart/angel_route
|
||||
environment:
|
||||
sdk: ">=2.10.0 <2.12.0"
|
||||
sdk: ">=2.10.0 <3.0.0"
|
||||
dependencies:
|
||||
combinator: ^1.0.0
|
||||
meta: ^1.0.0
|
||||
|
@ -13,6 +13,6 @@ dependencies:
|
|||
dev_dependencies:
|
||||
build_runner: ^1.11.1
|
||||
build_web_compilers: ^2.12.2
|
||||
http: ^0.12.2
|
||||
http: ^0.13.0
|
||||
pedantic: ^1.0.0
|
||||
test: ^1.15.7
|
|
@ -11,7 +11,7 @@ const List<Map<String, String>> people = [
|
|||
void main() {
|
||||
http.Client client;
|
||||
|
||||
final Router router = Router();
|
||||
final router = Router();
|
||||
HttpServer server;
|
||||
String url;
|
||||
|
||||
|
@ -111,13 +111,13 @@ void main() {
|
|||
group('top-level', () {
|
||||
group('get', () {
|
||||
test('root', () async {
|
||||
final res = await client.get(url);
|
||||
final res = await client.get(Uri.parse(url));
|
||||
print('Response: ${res.body}');
|
||||
expect(res.body, equals('Root'));
|
||||
});
|
||||
|
||||
test('path', () async {
|
||||
final res = await client.get('$url/hello');
|
||||
final res = await client.get(Uri.parse('$url/hello'));
|
||||
print('Response: ${res.body}');
|
||||
expect(res.body, equals('World'));
|
||||
});
|
||||
|
@ -127,20 +127,20 @@ void main() {
|
|||
group('group', () {
|
||||
group('top-level', () {
|
||||
test('root', () async {
|
||||
final res = await client.get('$url/people');
|
||||
final res = await client.get(Uri.parse('$url/people'));
|
||||
print('Response: ${res.body}');
|
||||
expect(json.decode(res.body), equals(people));
|
||||
});
|
||||
|
||||
group('param', () {
|
||||
test('root', () async {
|
||||
final res = await client.get('$url/people/0');
|
||||
final res = await client.get(Uri.parse('$url/people/0'));
|
||||
print('Response: ${res.body}');
|
||||
expect(json.decode(res.body), equals(people.first));
|
||||
});
|
||||
|
||||
test('path', () async {
|
||||
final res = await client.get('$url/people/0/name');
|
||||
final res = await client.get(Uri.parse('$url/people/0/name'));
|
||||
print('Response: ${res.body}');
|
||||
expect(json.decode(res.body), equals(people.first['name']));
|
||||
});
|
||||
|
@ -151,26 +151,28 @@ void main() {
|
|||
group('mount', () {
|
||||
group('path', () {
|
||||
test('top-level', () async {
|
||||
final res = await client.post('$url/beatles/spinal_clacker');
|
||||
final res = await client.post(Uri.parse('$url/beatles/spinal_clacker'));
|
||||
print('Response: ${res.body}');
|
||||
expect(res.body, equals('come together'));
|
||||
});
|
||||
|
||||
test('fallback', () async {
|
||||
final res = await client.patch('$url/beatles/muddy_water');
|
||||
final res = await client.patch(Uri.parse('$url/beatles/muddy_water'));
|
||||
print('Response: ${res.body}');
|
||||
expect(res.body, equals('together'));
|
||||
});
|
||||
|
||||
test('fallback', () async {
|
||||
final res = await client.patch('$url/beatles/spanil_clakcer');
|
||||
final res =
|
||||
await client.patch(Uri.parse('$url/beatles/spanil_clakcer'));
|
||||
print('Response: ${res.body}');
|
||||
expect(res.body, equals('together'));
|
||||
});
|
||||
});
|
||||
|
||||
test('deep nested', () async {
|
||||
final res = await client.get('$url/beatles/big/yellow/submarine');
|
||||
final res =
|
||||
await client.get(Uri.parse('$url/beatles/big/yellow/submarine'));
|
||||
print('Response: ${res.body}');
|
||||
expect(res.body, equals('we all live in a'));
|
||||
});
|
||||
|
@ -185,17 +187,17 @@ void main() {
|
|||
});
|
||||
|
||||
test('path', () async {
|
||||
await expect404(client.get('$url/foo'));
|
||||
await expect404(client.get('$url/bye'));
|
||||
await expect404(client.get('$url/people/0/age'));
|
||||
await expect404(client.get('$url/beatles2'));
|
||||
await expect404(client.get(Uri.parse('$url/foo')));
|
||||
await expect404(client.get(Uri.parse('$url/bye')));
|
||||
await expect404(client.get(Uri.parse('$url/people/0/age')));
|
||||
await expect404(client.get(Uri.parse('$url/beatles2')));
|
||||
});
|
||||
|
||||
test('method', () async {
|
||||
await expect404(client.head(url));
|
||||
await expect404(client.patch('$url/people'));
|
||||
await expect404(client.post('$url/people/0'));
|
||||
await expect404(client.delete('$url/beatles2/spinal_clacker'));
|
||||
await expect404(client.head(Uri.parse(url)));
|
||||
await expect404(client.patch(Uri.parse('$url/people')));
|
||||
await expect404(client.post(Uri.parse('$url/people/0')));
|
||||
await expect404(client.delete(Uri.parse('$url/beatles2/spinal_clacker')));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue