Closed wayne900204 closed 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.
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.
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.
okok, thx for answer~~
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