authenticatedRequest method

TestRequest authenticatedRequest (String path, { String accessToken: null })

Executes a request with a Bearer Authorization header to the application under test.

The path will be appended to the baseURL of this instance. You may omit or include the leading slash in the path, the result will be the same.

If you do not provide an accessToken, the value of defaultAccessToken will be used.


TestRequest authenticatedRequest(String path, {String accessToken: null}) {
  accessToken ??= defaultAccessToken;

  var req = request(path)..bearerAuthorization = accessToken;
  return req;