Bind the decoder to req.body
This commit is contained in:
parent
185b5d6598
commit
d88e289807
2 changed files with 2 additions and 2 deletions
|
@ -113,7 +113,7 @@ main() {
|
||||||
}, optional: ['bar']));
|
}, optional: ['bar']));
|
||||||
var rq = MockHttpRequest('GET', Uri(path: 'foo'));
|
var rq = MockHttpRequest('GET', Uri(path: 'foo'));
|
||||||
await AngelHttp(app).handleRequest(rq);
|
await AngelHttp(app).handleRequest(rq);
|
||||||
var body = await rq.response.transform(utf8.decoder).join();
|
var body = await utf8.decoder.bind(rq.response).join();
|
||||||
expect(json.decode(body), 2);
|
expect(json.decode(body), 2);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ main() {
|
||||||
app.container.registerSingleton(Todo(text: TEXT, over: OVER));
|
app.container.registerSingleton(Todo(text: TEXT, over: OVER));
|
||||||
app.container.registerFactory<Future<Foo>>((container) async {
|
app.container.registerFactory<Future<Foo>>((container) async {
|
||||||
var req = container.make<RequestContext>();
|
var req = container.make<RequestContext>();
|
||||||
var text = await req.body.transform(utf8.decoder).join();
|
var text = await utf8.decoder.bind(req.body).join();
|
||||||
return Foo(text);
|
return Foo(text);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue