httpBasic function

RequestPostProcessor httpBasic(
  1. String username,
  2. String password
)

Adds an Authorization: Basic header with username and password, so the real Basic login runs and checks them against the application's users.

Use it to test the login itself; user is shorter for everything else.

Implementation

RequestPostProcessor httpBasic(String username, String password) =>
    FunctionRequestPostProcessor((request) {
      request.headers.set(
        HttpHeaders.authorizationHeader,
        'Basic ${base64.encode(utf8.encode('$username:$password'))}',
      );
      return request;
    });