withCookies method

DoxTestClient withCookies(
  1. Map<String, String> values
)

a copy of this client that sends values as cookies. Use the cookies of a response to go on with its session.

TestResponse login = await client.post('/login', body: form);
DoxTestClient user = client.withCookies(login.cookies);

Implementation

DoxTestClient withCookies(Map<String, String> values) {
  return withHeaders(<String, String>{
    HttpHeaders.cookieHeader: <String>[
      for (MapEntry<String, String> c in values.entries)
        '${c.key}=${c.value}',
    ].join('; '),
  });
}