+20
This commit is contained in:
parent
41a73d0b20
commit
269b0483db
5 changed files with 16 additions and 8 deletions
|
@ -1,6 +1,6 @@
|
||||||
# angel_client
|
# angel_client
|
||||||
|
|
||||||
[](https://pub.dartlang.org/packages/angel_client)
|
[](https://pub.dartlang.org/packages/angel_client)
|
||||||

|

|
||||||
|
|
||||||
Client library for the Angel framework.
|
Client library for the Angel framework.
|
||||||
|
|
|
@ -136,7 +136,7 @@ abstract class BaseAngelClient extends Angel {
|
||||||
|
|
||||||
String _join(url) {
|
String _join(url) {
|
||||||
final head = basePath.replaceAll(new RegExp(r'/+$'), '');
|
final head = basePath.replaceAll(new RegExp(r'/+$'), '');
|
||||||
final tail = basePath.replaceAll(straySlashes, '');
|
final tail = url.replaceAll(straySlashes, '');
|
||||||
return '$head/$tail';
|
return '$head/$tail';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
name: angel_client
|
name: angel_client
|
||||||
version: 1.0.0-dev+19
|
version: 1.0.0-dev+20
|
||||||
description: Client library for the Angel framework.
|
description: Client library for the Angel framework.
|
||||||
author: Tobe O <thosakwe@gmail.com>
|
author: Tobe O <thosakwe@gmail.com>
|
||||||
homepage: https://github.com/angel-dart/angel_client
|
homepage: https://github.com/angel-dart/angel_client
|
||||||
|
|
|
@ -30,9 +30,15 @@ main() {
|
||||||
await httpServer.close(force: true);
|
await httpServer.close(force: true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('plain requests', () async {
|
||||||
|
final response = await clientApp.get('/foo');
|
||||||
|
print(response.body);
|
||||||
|
});
|
||||||
|
|
||||||
test("index", () async {
|
test("index", () async {
|
||||||
Postcard niagaraFalls = await serverPostcards.create(
|
Postcard niagaraFalls = await serverPostcards.create(
|
||||||
new Postcard(location: "Niagara Falls", message: "Missing you!"));
|
new Postcard(location: "Niagara Falls", message: "Missing you!"));
|
||||||
|
print('Niagra Falls: ${niagaraFalls.toJson()}');
|
||||||
List<Map> indexed = await clientPostcards.index();
|
List<Map> indexed = await clientPostcards.index();
|
||||||
print(indexed);
|
print(indexed);
|
||||||
|
|
||||||
|
|
|
@ -9,12 +9,14 @@ class Postcard extends MemoryModel {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(other) {
|
bool operator ==(other) {
|
||||||
if (!(other is Postcard))
|
if (!(other is Postcard)) return false;
|
||||||
return false;
|
|
||||||
|
|
||||||
return id == other.id && location == other.location &&
|
return id == other.id &&
|
||||||
|
location == other.location &&
|
||||||
message == other.message;
|
message == other.message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Map toJson() {
|
||||||
|
return {'id': id, 'location': location, 'message': message};
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue