mock_request 1.0.7 copy "mock_request: ^1.0.7" to clipboard
mock_request: ^1.0.7 copied to clipboard

Manufacture dart:io HttpRequests, HttpResponses, HttpHeaders, etc.

mock_request #

Pub build status

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 testing Angel applications smoother, but works with any Dart-based server. :)

Usage #

var rq = new 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!')));

More examples can be found in the included tests.

1
likes
30
points
217
downloads

Publisher

unverified uploader

Weekly Downloads

Manufacture dart:io HttpRequests, HttpResponses, HttpHeaders, etc.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

charcode

More

Packages that depend on mock_request