platform/packages/mocking
2024-09-28 16:14:48 -07:00
..
example update(angel3): refactoring and adding api inline help 2024-09-24 21:04:57 -07:00
lib update(angel3): refactoring and adding api inline help 2024-09-24 21:04:57 -07:00
test update(angel3): rebranding angel3 2024-09-28 16:14:48 -07:00
.gitignore update(angel3): re-branding angel3 mock_request 2024-09-23 13:16:45 -07:00
analysis_options.yaml update(angel3): re-branding angel3 mock_request 2024-09-23 13:16:45 -07:00
AUTHORS.md update(angel3): re-branding angel3 mock_request 2024-09-23 13:16:45 -07:00
CHANGELOG.md update(angel3): re-branding angel3 2024-09-23 13:35:32 -07:00
LICENSE update(angel3): re-branding angel3 mock_request 2024-09-23 13:16:45 -07:00
pubspec.yaml update(angel3): refactoring and adding api inline help 2024-09-24 21:04:57 -07:00
README.md update(angel3): re-branding angel3 2024-09-23 13:35:32 -07: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 Protevus 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.