Skip to content

Allow body transfer encoding overrides #1228

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

Merged
merged 2 commits into from
Feb 11, 2025

Conversation

phieronymus
Copy link
Collaborator

It was asked for the services multiple time and backend was changed but it is only a matter of time before customer want to do the same as the web specifications allow for pretty wild usage.

@phieronymus phieronymus added the Enhancement New feature or request label Feb 7, 2025
Comment on lines 269 to 270
bodyTransferEncoding === "entity"
? true && ![HTTPMethod.GET, HTTPMethod.HEAD].includes(method)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per specification GET and HEAD can never have a payload.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need the true && part here? 🤔

? true && ![HTTPMethod.GET, HTTPMethod.HEAD].includes(method)
: bodyTransferEncoding === "message"
? false
: ![HTTPMethod.GET, HTTPMethod.HEAD, HTTPMethod.DELETE].includes(method);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sneakily added HEAD in the default cases as it was missing.

@coveralls
Copy link

coveralls commented Feb 7, 2025

Coverage Status

coverage: 98.738% (+0.005%) from 98.733%
when pulling 4d394d3 on feature/pierreh/allow-body-transfer-encoding-override
into c59fc54 on master.

Copy link
Collaborator

@YusukeFukushima YusukeFukushima left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 🙇
I'll not use it at this time, but whenever I may use this

@phieronymus
Copy link
Collaborator Author

@YusukeFukushima Yeah. It is best not to use a body for the delete call method as it is not recommended. This if for customer who do not have the choice given their API.

/**
* Overrides default body transfer encoding of the request.
*
* Note: Can not for for GET and HEAD request
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cannot and remove duplicate for?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ups. Thanks.

Comment on lines 269 to 270
bodyTransferEncoding === "entity"
? true && ![HTTPMethod.GET, HTTPMethod.HEAD].includes(method)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need the true && part here? 🤔

@gdp88
Copy link
Collaborator

gdp88 commented Feb 7, 2025

minor comments..lgtm!

@phieronymus
Copy link
Collaborator Author

Indeed, the true was not necessary, thanks for catching this 🙂

@gdp88
Copy link
Collaborator

gdp88 commented Feb 11, 2025

thanx! merging!

@gdp88 gdp88 merged commit a163cc7 into master Feb 11, 2025
6 checks passed
@gdp88 gdp88 deleted the feature/pierreh/allow-body-transfer-encoding-override branch February 11, 2025 17:11
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.

4 participants