We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unhandled Exception: HttpException: Content-Length must contain only digits, uri = http://192.168.200.1/AWIP.html E/flutter ( 5783): #0 _HttpHeaders._addContentLength (dart:_http/http_headers.dart:383:9) E/flutter ( 5783): #1 _HttpHeaders._add (dart:_http/http_headers.dart:359:11) E/flutter ( 5783): #2 _HttpParser._doParse (dart:_http/http_parser.dart:725:23) E/flutter ( 5783): #3 _HttpParser._parse (dart:_http/http_parser.dart:319:7) E/flutter ( 5783): #4 _HttpParser._onData (dart:_http/http_parser.dart:873:5) E/flutter ( 5783): #5 _RootZone.runUnaryGuarded (dart:async/zone.dart:1593:10) E/flutter ( 5783): #6 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:339:11) E/flutter ( 5783): #7 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7) E/flutter ( 5783): #8 _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:774:19) E/flutter ( 5783): #9 _StreamController._add (dart:async/stream_controller.dart:648:7) E/flutter ( 5783): #10 _StreamController.add (dart:async/stream_controller.dart:596:5) E/flutter ( 5783): #11 _Socket._onData (dart:io-patch/socket_patch.dart:2355:41) E/flutter ( 5783): #12 _RootZone.runUnaryGuarded (dart:async/zone.dart:1593:10) E/flutter ( 5783): #13 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:339:11) E/flutter ( 5783): #14 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7) E/flutter ( 5783): #15 _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:774:19) E/flutter ( 5783): #16 _StreamController._add (dart:async/stream_controller.dart:648:7) E/flutter ( 5783): #17 _StreamController.add (dart:async/stream_controller.dart:596:5) E/flutter ( 5783): #18 new _RawSocket. (dart:io-patch/socket_patch.dart:1877:33) E/flutter ( 5783): #19 _NativeSocket.issueReadEvent.issue (dart:io-patch/socket_patch.dart:1334:14) E/flutter ( 5783): #20 _microtaskLoop (dart:async/schedule_microtask.dart:40:21) E/flutter ( 5783): #21 _startMicrotaskLoop (dart:async/schedule_microtask.dart:49:5)
` static void dummyCall({required String url,required Map map}) async{ HttpClient client = HttpClient();
// Creating body here List body = utf8.encode(json.encode(map));
HttpClientRequest request = await client.postUrl(Uri.parse(url)); request.headers.set('content-type', 'application/json'); log("CONTENT LENGTH ${body.length}"); request.headers.set('Accept', 'application/json');
// Setting the content-length header here request.headers.set('Content-Length', 17);
// Adding the body to the request log("HEADER ${request.headers.toString()}"); request.add(body);
HttpClientResponse response = await request.close(); log("RESPONSE ${response.statusCode}");
}`
The text was updated successfully, but these errors were encountered:
What server is are you running this against? HttpClient does not correctly parse Content-Length headers containing extra whitespace.
HttpClient
Content-Length
Sorry, something went wrong.
i got the same error, i backward to flutter 3.3.4 and it run well. still have no idea
I I also encountered the same problem I use mongose server
The issue is caused by extra whitespace in the "Content-Length" header returned by the mongose service. The header looks something like this:
Content-Length: 43 \r\n Adding a trim operation would be better!
Thanks for the reproduction @menshen - we are working on this now.
This is a Dart issue and will be fixed in Dart 3.2.0
brianquinlan
No branches or pull requests
Unhandled Exception: HttpException: Content-Length must contain only digits, uri = http://192.168.200.1/AWIP.html
E/flutter ( 5783): #0 _HttpHeaders._addContentLength (dart:_http/http_headers.dart:383:9)
E/flutter ( 5783): #1 _HttpHeaders._add (dart:_http/http_headers.dart:359:11)
E/flutter ( 5783): #2 _HttpParser._doParse (dart:_http/http_parser.dart:725:23)
E/flutter ( 5783): #3 _HttpParser._parse (dart:_http/http_parser.dart:319:7)
E/flutter ( 5783): #4 _HttpParser._onData (dart:_http/http_parser.dart:873:5)
E/flutter ( 5783): #5 _RootZone.runUnaryGuarded (dart:async/zone.dart:1593:10)
E/flutter ( 5783): #6 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:339:11)
E/flutter ( 5783): #7 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
E/flutter ( 5783): #8 _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:774:19)
E/flutter ( 5783): #9 _StreamController._add (dart:async/stream_controller.dart:648:7)
E/flutter ( 5783): #10 _StreamController.add (dart:async/stream_controller.dart:596:5)
E/flutter ( 5783): #11 _Socket._onData (dart:io-patch/socket_patch.dart:2355:41)
E/flutter ( 5783): #12 _RootZone.runUnaryGuarded (dart:async/zone.dart:1593:10)
E/flutter ( 5783): #13 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:339:11)
E/flutter ( 5783): #14 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
E/flutter ( 5783): #15 _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:774:19)
E/flutter ( 5783): #16 _StreamController._add (dart:async/stream_controller.dart:648:7)
E/flutter ( 5783): #17 _StreamController.add (dart:async/stream_controller.dart:596:5)
E/flutter ( 5783): #18 new _RawSocket. (dart:io-patch/socket_patch.dart:1877:33)
E/flutter ( 5783): #19 _NativeSocket.issueReadEvent.issue (dart:io-patch/socket_patch.dart:1334:14)
E/flutter ( 5783): #20 _microtaskLoop (dart:async/schedule_microtask.dart:40:21)
E/flutter ( 5783): #21 _startMicrotaskLoop (dart:async/schedule_microtask.dart:49:5)
`
static void dummyCall({required String url,required Map map}) async{
HttpClient client = HttpClient();
// Creating body here
List body = utf8.encode(json.encode(map));
// Setting the content-length header here
request.headers.set('Content-Length', 17);
// Adding the body to the request
log("HEADER ${request.headers.toString()}");
request.add(body);
}`
The text was updated successfully, but these errors were encountered: