hagaygo / OpenWrtManager

Mobile app for interacting with your OpenWrt device.
GNU General Public License v3.0
145 stars 10 forks source link

Can you explain why i need to change content-length? #26

Closed wayne900204 closed 2 years ago

wayne900204 commented 2 years ago

if I don't change content-length, I got 403, How did this happened?

https://github.com/hagaygo/OpenWRTManager/blob/github/lib/OpenWRT/OpenWRTClient.dart#L161-L165

hagaygo commented 2 years ago

Hi,

I am not sure what are you asking.

The app does not work for you ? Authentication is failing ? You are trying to change the code ?

Please supply more details on your issue.

wayne900204 commented 2 years ago

well, the code is correct. I'm wondering why we need to set content-length. If I annotate this code. It would get 403.

When I use postman, I don't need to add content-length in the header. So I'm wondering why we need to set content-length in app.

hagaygo commented 2 years ago

Well , if you know the content length , its generally better to send it to the server from various reason (for example the server might not accept large posts so it will reject your request before you even start to send).

If your findings are correct , Maybe its because of flutter's http client or maybe postman does send the header without telling you , did not test.

wayne900204 commented 2 years ago

okok, thx for answer~~