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 # 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) ![build status](https://travis-ci.org/angel-dart/client.svg)
Client library for the Angel framework. Client library for the Angel framework.

View file

@ -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';
} }

View file

@ -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

View file

@ -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);

View file

@ -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};
}
} }