Skip to content
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

set 'Content-Length' automaticly #41

Closed
wants to merge 1 commit into from
Closed

set 'Content-Length' automaticly #41

wants to merge 1 commit into from

Conversation

cjqpker
Copy link

@cjqpker cjqpker commented Jun 11, 2020

Set 'Content-Length' automaticly when set body into request

This setting is suit for most scenarios, and sure you can set it back to zero if needed.

Set 'Content-Length' automaticly when set body into request

This setting is suit for most scenarios, and sure you can set it back to zero if needed.
@jayjamesjay
Copy link
Owner

jayjamesjay commented Jun 15, 2020

This can be useful in many cases but I think sometimes it can lead to unexpected behaviors such as you first set header Content-Length with value 20, then you set body (with width 50) and value of Content-Length becomes 50, which is not the intent of the user.

In my humble opinion implementing higher level abstraction just for sending post requests would be a much better solution. Something like post fn taking uri and body as parameters.

Please let me know what you think and also please take a look at commit add post fn.

@jayjamesjay jayjamesjay added the question Further information is requested label Jun 16, 2020
@cjqpker
Copy link
Author

cjqpker commented Jun 22, 2020

Set header Content-Length to the actual length of body is more common, in my opinion, and user can set it again if there is some special usecase, which may not be often

@jayjamesjay jayjamesjay added enhancement New feature or request and removed question Further information is requested labels Oct 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants