angel3_mock_request 7.0.1 icon indicating copy to clipboard operation
angel3_mock_request: ^7.0.1 copied to clipboard

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

Mock HTTP Request #

Pub Version (including pre-releases) Null Safety Gitter License

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!')));

More examples can be found in the included test cases.

0
likes
140
pub points
54%
popularity

Publisher

verified publisher icondukefirehawk.com

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

Homepage
Repository (GitHub)

Documentation

API reference

License

Icon for licenses.BSD-3-Clause (LICENSE)

Dependencies

charcode

More

Packages that depend on angel3_mock_request