request method

Future<DocumentResponse> request(
  1. String location
)

Perform a virtual request to your app that renders the components and returns the resulting document.

Implementation

Future<DocumentResponse> request(String location) async {
  var uri = Uri.parse('http://test.server$location');

  var response = await _handler(Request('GET', uri));
  var statusCode = response.statusCode;
  var body = await response.readAsString();

  var doc = statusCode == 200 ? parse(body) : null;

  return DocumentResponse(
    statusCode: statusCode,
    body: body,
    document: doc?.body != null ? doc : null,
  );
}