login method

Future<void> login(
  1. DockerAuthInfo auth
)

Authenticates with a Docker registry.

Sends POST /auth with the credentials from auth. A 200 response (optionally containing an identity token) indicates success; any 4xx/5xx status throws HttpException.

Parameters:

Implementation

Future<void> login(DockerAuthInfo auth) async {
  final resp = await _request(
    'POST',
    '/auth',
    body: {
      'username': auth.username,
      'password': auth.password,
      'serveraddress': auth.registry,
    },
  );
  if (resp.statusCode != 200 && resp.statusCode != 204) {
    _throwIfError(resp);
  }
}