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

feat: adds more standard compliant request body handling #2260

Merged
merged 1 commit into from
Apr 12, 2023

Conversation

daniel-white
Copy link

Addresses #2255

Summary

  • removes Content-Type as a detection mechanism for request bodies
  • adds more detailed error when the proxy detects a request body in a GET/HEAD request, which node-fetch does not support

Checklist

  • The basics
    • I tested these changes manually in my local or dev environment
  • Tests
    • Added or updated
    • N/A
  • Event Tracking
    • I added event tracking and followed the event tracking guidelines
    • N/A
  • Error Reporting
    • I reported errors and followed the error reporting guidelines
    • N/A

@daniel-white daniel-white marked this pull request as ready for review April 12, 2023 17:37
@daniel-white daniel-white requested a review from a team as a code owner April 12, 2023 17:37
@daniel-white daniel-white requested review from brendarearden and removed request for a team April 12, 2023 17:37
Copy link
Contributor

@EdVinyard EdVinyard left a comment

Choose a reason for hiding this comment

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

Other than a single question for my own curiosity, this looks good to me.

====server====
proxy -p 4010 ${document} http://httpbin.org
====command====
curl -i http://localhost:4010/status/204 -X GET --header 'Content-Type: application/json' --data '{}'
Copy link
Contributor

Choose a reason for hiding this comment

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

I've never tried to do this before. Does '{}' get serialized to a zero-length request body?

Copy link
Author

Choose a reason for hiding this comment

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

yea - its a verbatim string here - so the request body is just {}

@daniel-white daniel-white merged commit 3b56cb7 into master Apr 12, 2023
@daniel-white daniel-white deleted the fix/request-body branch April 12, 2023 17:53
This was referenced Apr 29, 2024
This was referenced Jul 2, 2024
This was referenced Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants