You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
i'm trying to send a POST to my server. I'm sure about the server is working, becouse it accept POST from another client and it works perfectly.
Using wireshark i discovered that i'm sending a message without a header, so the server refuse it with 411 error (Length required), but i think the problem is that the whole heder is missing, not only content-length.
I have done a function that take server address and data for wrap http.post and make a complete request using only that 2 parameters.
This is my function:
-----------------------------* Future<http.Response> sendPost(String address, String data) { Uri parsedUrl = Uri.parse(address); Map<String, String> headersMap = { 'Content-Type': 'application/json; charset=UTF-8', 'Content-length': '${data.length}', 'Accept': 'application/json', }; return http.post(parsedUrl, headers: headersMap, body: data); }
-----------------------------*
As you can see i setted header into the Map<String,String>
I put a print for check header => print(headersMap.toString());
and this is the result
-----------------------------
{Content-Type: application/json; charset=UTF-8, Content-length: 124, Accept: application/json}
-----------------------------
And it seems ok...
This is the packet i see on wireshark:
-----------------------------# PÂS´Ý½E¤@À¨À¨ÌûPò¯òòPúðê=d+'%""4#55d|dvv|vv|s#|vv|su|' djd/6""4#55d|dwthwp~hvhwdjd!'2#1'?d|dwthwp~hvhtdjd".%6d| '*5#jd$4)-#4�722d|dwthwp~hvh~d;
-----------------------------#
Before =d is part of the http message, at =d my message start (is a crypted json)
An exemple of packet send with another client is long more than double (383 vs 178).
So i'm trying to understand if this is my fault or if this is a bug.
Thanks for help.
The text was updated successfully, but these errors were encountered:
Hello,
i'm trying to send a POST to my server. I'm sure about the server is working, becouse it accept POST from another client and it works perfectly.
Using wireshark i discovered that i'm sending a message without a header, so the server refuse it with 411 error (Length required), but i think the problem is that the whole heder is missing, not only content-length.
I have done a function that take server address and data for wrap http.post and make a complete request using only that 2 parameters.
This is my function:
-----------------------------*
Future<http.Response> sendPost(String address, String data) { Uri parsedUrl = Uri.parse(address); Map<String, String> headersMap = { 'Content-Type': 'application/json; charset=UTF-8', 'Content-length': '${data.length}', 'Accept': 'application/json', }; return http.post(parsedUrl, headers: headersMap, body: data); }
-----------------------------*
As you can see i setted header into the Map<String,String>
I put a print for check header => print(headersMap.toString());
and this is the result
-----------------------------
{Content-Type: application/json; charset=UTF-8, Content-length: 124, Accept: application/json}
-----------------------------
And it seems ok...
This is the packet i see on wireshark:
-----------------------------#
PÂS´Ý½E¤@À¨À¨ÌûPò¯òòPúðê=d+'%""4#55d|dvv|vv|s#|vv|su|' djd/6""4#55d|dwthwp~hvhwdjd!'2#1'?d|dwthwp~hvhtdjd".%6d| '*5#jd$4)-#4�722d|dwthwp~hvh~d;
-----------------------------#
Before
=d
is part of the http message, at=d
my message start (is a crypted json)An exemple of packet send with another client is long more than double (383 vs 178).
So i'm trying to understand if this is my fault or if this is a bug.
Thanks for help.
The text was updated successfully, but these errors were encountered: