Skip to content

Commit

Permalink
Update pkgs/cronet_http/lib/src/cronet_client.dart
Browse files Browse the repository at this point in the history
Co-authored-by: Nate Bosch <nbosch1@gmail.com>
  • Loading branch information
brianquinlan and natebosch authored Jul 21, 2023
1 parent e308c7f commit 686e2d3
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions pkgs/cronet_http/lib/src/cronet_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,8 @@ class CronetClient extends BaseClient {
.cast<String, List<Object?>>()
.map((key, value) => MapEntry(key.toLowerCase(), value.join(',')));

final contentLengthHeader = responseHeaders['content-length'];
int? contentLength;
if (contentLengthHeader != null) {
if (responseHeaders['content-length'] case final contentLengthHeader?) {
if (!RegExp(r'^\d+$').hasMatch(contentLengthHeader)) {
throw ClientException(
'Invalid content-length header [$contentLengthHeader].',
Expand Down

0 comments on commit 686e2d3

Please sign in to comment.