Short-hand for expect
and hasResponse that returns response
.
This convenience method runs an expectation on response
using hasResponse built from statusCode
, body
, and headers
, that is:
expect(response, hasResponse(statusCode, body, headers: headers));
It makes typical test code easier to compose without having to declare local variables:
expectResponse(await client.request("/foo").get(),
200, body: "foo", headers: {"x-foo": "foo"});
This method always returns response
so that it can be used elsewhere in the test.
Source
TestResponse expectResponse( TestResponse response, int statusCode, {dynamic body, Map<String, dynamic> headers}) { expect(response, hasResponse(statusCode, body, headers: headers)); return response; }