toString method
Return the Proxy-Authorization or WWW-Authorization header value.
Implementation
@override
String toString() {
List<String> auth_params = <String>[];
if (_response == null) {
throw AssertionError(
'response field does not exist, cannot generate Authorization header');
}
auth_params.add('algorithm=$_algorithm');
auth_params.add('username="${_credentials.username}"');
auth_params.add('realm="$_realm"');
auth_params.add('nonce="$_nonce"');
auth_params.add('uri="$_uri"');
auth_params.add('response="$_response"');
if (_opaque != null) {
auth_params.add('opaque="$_opaque"');
}
if (_qop != null) {
auth_params.add('qop=$_qop');
auth_params.add('cnonce="$_cnonce"');
auth_params.add('nc=$_ncHex');
}
if (_stale != null) {
auth_params.add('stale=${_stale! ? 'true' : 'false'}');
}
return 'Digest ${auth_params.join(', ')}';
}