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

fix: correct regex for binary types #3564

Closed
wants to merge 1 commit into from
Closed

fix: correct regex for binary types #3564

wants to merge 1 commit into from

Conversation

Xenonym
Copy link
Contributor

@Xenonym Xenonym commented Nov 2, 2021

Summary

The regex to match binary MIME types had a typo (applicaton/octet-stream, note the missing i). This PR fixes that by correcting the regex so that application is only spelled once.

This PR also follows the behavior documented in this forum answer where all application/* content types are base64 encoded except for some known text types:

The fix

Going forward, we will base64 encode the body if the content-type starts with application/. This will ensure that binary media types like application/octet-stream and application/pdf arrive at their final destinations intact.

Exceptions

Requests with the following content-types will not be base64 encoded, even though they start with application/:

  • application/json or application/*+json
  • application/xml or application/*+xml
  • application/javascript
  • application/csp-report
  • application/graphql
  • application/x-www-form-urlencoded
  • application/x-ndjson

A picture of a cute animal (not mandatory, but encouraged)
🐫

@erezrokah erezrokah added the type: bug code to address defects in shipped code label Nov 4, 2021
@Xenonym Xenonym changed the title fix: correct and simplify regex for binary types fix: correct regex for binary types Nov 10, 2021
@Xenonym
Copy link
Contributor Author

Xenonym commented Nov 17, 2021

Closing in favour of #3631.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug code to address defects in shipped code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants