http
http copied to clipboard
Both Content-Length and Transfer-Encoding are specified, at most one is allowed
Request:
http.Response response = await http.post(
Uri.parse(url),
headers: {
'Content-Type': 'application/json'
},
body: requestDto.toRawJson(),
encoding: Encoding.getByName("utf-8")
);
/// Json encoded request length
requestDto.toRawJson().length; // ==> 608
And then http package throws the following exception:
│ #0 IOClient.send (package:http/src/io_client.dart:61:7)
│ #1 <asynchronous suspension>
│ #2 BaseClient._sendUnstreamed (package:http/src/base_client.dart:93:32)
│ #3 <asynchronous suspension>
│ #4 _withClient (package:http/http.dart:164:12)
│ #5 <asynchronous suspension>
│ #6 Future.timeout.<anonymous closure> (dart:async/future_impl.dart)
│ #7 <asynchronous suspension>
├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
│ ⛔ Both Content-Length and Transfer-Encoding are specified, at most one is allowed
I tried to declare both Content-Length and Transfer-Encoding as null and there was no difference.
Did you find any answer for this, right now I am facing such situation that network is giving me this question