This commit is contained in:
thosakwe 2016-12-10 12:28:24 -05:00
parent 41a73d0b20
commit 269b0483db
5 changed files with 16 additions and 8 deletions

View file

@ -1,6 +1,6 @@
# angel_client
[![pub 1.0.0-dev+19](https://img.shields.io/badge/pub-1.0.0--dev+19-red.svg)](https://pub.dartlang.org/packages/angel_client)
[![pub 1.0.0-dev+20](https://img.shields.io/badge/pub-1.0.0--dev+20-red.svg)](https://pub.dartlang.org/packages/angel_client)
![build status](https://travis-ci.org/angel-dart/client.svg)
Client library for the Angel framework.

View file

@ -136,7 +136,7 @@ abstract class BaseAngelClient extends Angel {
String _join(url) {
final head = basePath.replaceAll(new RegExp(r'/+$'), '');
final tail = basePath.replaceAll(straySlashes, '');
final tail = url.replaceAll(straySlashes, '');
return '$head/$tail';
}

View file

@ -1,5 +1,5 @@
name: angel_client
version: 1.0.0-dev+19
version: 1.0.0-dev+20
description: Client library for the Angel framework.
author: Tobe O <thosakwe@gmail.com>
homepage: https://github.com/angel-dart/angel_client

View file

@ -30,9 +30,15 @@ main() {
await httpServer.close(force: true);
});
test('plain requests', () async {
final response = await clientApp.get('/foo');
print(response.body);
});
test("index", () async {
Postcard niagaraFalls = await serverPostcards.create(
new Postcard(location: "Niagara Falls", message: "Missing you!"));
print('Niagra Falls: ${niagaraFalls.toJson()}');
List<Map> indexed = await clientPostcards.index();
print(indexed);

View file

@ -9,12 +9,14 @@ class Postcard extends MemoryModel {
@override
bool operator ==(other) {
if (!(other is Postcard))
return false;
if (!(other is Postcard)) return false;
return id == other.id && location == other.location &&
return id == other.id &&
location == other.location &&
message == other.message;
}
}
Map toJson() {
return {'id': id, 'location': location, 'message': message};
}
}