platform/packages/mock_request
thomashii@dukefirehawk.com 308d6df606 Updated pubspec
2022-08-29 01:51:56 +08:00
..
example Publish angel3_merge_map and angel3_mock_request 2021-05-14 16:06:16 +08:00
lib Updated to 6.0.0 2022-02-14 00:48:37 +08:00
test Updated pubspec 2022-08-29 01:51:56 +08:00
.gitignore Publish angel3_merge_map and angel3_mock_request 2021-05-14 16:06:16 +08:00
analysis_options.yaml Updated linter 2022-01-04 20:03:52 +08:00
AUTHORS.md Publish angel3_merge_map and angel3_mock_request 2021-05-14 16:06:16 +08:00
CHANGELOG.md Updated Change Log 2022-08-16 19:19:04 +08:00
LICENSE Updated linter 2022-01-04 20:03:52 +08:00
melos_angel3_mock_request.iml Added melos 2022-03-19 09:37:28 +08:00
pubspec.yaml Updated pubspec 2022-08-29 01:51:56 +08:00
README.md Updated linter 2022-01-04 20:03:52 +08:00

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.