[io] HttpClient: add a more descriptive message if the HTTP
authentication challenge is incorrectly formatted. Bug:https://github.com/dart-lang/sdk/issues/57117 Change-Id: Iceace8ae5c43293f66c2167e2c5ee598e5fecb54 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/402280 Commit-Queue: Brian Quinlan <bquinlan@google.com> Reviewed-by: Lasse Nielsen <lrn@google.com>
This commit is contained in:
committed by
Commit Queue
parent
68849148fd
commit
d2d2bf8e4f
@@ -845,10 +845,18 @@ class _HttpClientResponse extends _HttpInboundMessageListInt
|
||||
|
||||
List<String> challenge = authChallenge()!;
|
||||
assert(challenge.length == 1);
|
||||
_HeaderValue header = _HeaderValue.parse(
|
||||
challenge[0],
|
||||
parameterSeparator: ",",
|
||||
);
|
||||
final _HeaderValue header;
|
||||
try {
|
||||
header = _HeaderValue.parse(challenge[0], parameterSeparator: ",");
|
||||
} on HttpException catch (_, s) {
|
||||
Error.throwWithStackTrace(
|
||||
HttpException(
|
||||
'The authentication challenge sent by the server is '
|
||||
'not correctly formatted.',
|
||||
),
|
||||
s,
|
||||
);
|
||||
}
|
||||
_AuthenticationScheme scheme = _AuthenticationScheme.fromString(
|
||||
header.value,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user