angel3_mock_request

Last updated:

0 purchases

angel3_mock_request Image
angel3_mock_request Images
Add to Cart

Description:

angel3 mock request

Mock HTTP Request #




Forked from mock_request to support NNBD
Manufacture dart:io HttpRequests, HttpResponses, HttpHeaders, etc. This makes it possible to test server-side Dart applications without having to ever bind to a port.
This package was originally designed to make testing Angel3 applications smoother, but works with any Dart-based server.
Usage #
var rq = MockHttpRequest('GET', Uri.parse('/foo'));
await rq.close();
await app.handleRequest(rq); // Run within your server-side application
var rs = rq.response;
expect(rs.statusCode, equals(200));
expect(await rs.transform(UTF8.decoder).join(),
equals(JSON.encode('Hello, world!')));
copied to clipboard
More examples can be found in the included test cases.

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.