-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
area-vmUse area-vm for VM related issues, including code coverage, and the AOT and JIT backends.Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.library-io
Description
- Dart 2.7.0
- Flutter on Android
I needed to make an HTTP Post request without data chuncking.
On my first attempts I didn't set the contentLength
because I didn't had to do it with chunked transfer so far.
The request was executed but with an empty body.
After setting the length it worked like here:
final request = await client.postUrl(Uri.parse(endPointUrl));
request.headers.chunkedTransferEncoding = false;
request.headers.contentType = ContentType.json;
request.headers.set('accept-encoding', 'gzip,deflate');
var content = utf8.encode(asJson);
request.contentLength = content.length;
request.add(content = content);
final response = await request.close();
As it took me quite some time to figure this out, I see this either as a bug, because the chunked version doesn't behave like the non chunked one without throwing any assert or exeception, or at least there should be a hint in the API docs of request.headers.chunkedTransferEncoding
so that people know that they have to set a length.
nixonoftheyear and axxop
Metadata
Metadata
Assignees
Labels
area-vmUse area-vm for VM related issues, including code coverage, and the AOT and JIT backends.Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.library-io