Skip to content

Header missing on post send #880

New issue

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

Open
Mastroh91 opened this issue Feb 24, 2023 · 1 comment
Open

Header missing on post send #880

Mastroh91 opened this issue Feb 24, 2023 · 1 comment
Labels
package:http type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@Mastroh91
Copy link

Mastroh91 commented Feb 24, 2023

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.

@Mastroh91 Mastroh91 added package:http type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) labels Feb 24, 2023
@Mastroh91 Mastroh91 changed the title Header missing on post sen Header missing on post send Feb 24, 2023
@hoo0
Copy link

hoo0 commented Mar 11, 2023

I found that if i send "POST" method, server get "OPTIONS" method.
I tested that "POST" method on POSTMAN is OK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:http type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

2 participants