MvcResult class final
The request a MockMvc call sent and the response it got.
Get it with await or ResultActions.andReturn to read what
ResultActions.andExpect cannot check: response bytes, cookies, or the
events of a stream. For a server-sent event stream it is ready once the
headers are out, while the application is still writing; read the
events from MockServerHttpResponse.eventStream and end the stream
with cancel.
final result = await app.mockMvc.get('/api/books/changes').andReturn();
final next = result.response.eventStream.first; // the next event
...
await result.cancel(); // the client goes away
Spring (Java): MvcResult.
Properties
-
completion
→ Future<
void> -
Completes when the application has finished handling the request;
for a stream, when the stream ended or cancel was called.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- request → MockServerHttpRequest
-
The request as it was sent, after the post-processors.
final
- response → MockServerHttpResponse
-
The response:
statusCode,headers,cookies,bodyText,bodyBytes,json. For a stream it is still being written; see MockServerHttpResponse.eventStream.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
cancel(
) → Future< void> - Ends a streamed response from the client's side, as if the client went away, and completes when the application has finished the request.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited