-
Notifications
You must be signed in to change notification settings - Fork 365
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: resemble Netlify Production logic for base64 encoding more closely #3631
Conversation
📊 Benchmark resultsComparing with 72927da Package size: 365 MB⬇️ 0.00% decrease vs. 72927da
Legend
|
requests without a content-type will be base64-encoded this also applies to HTTP GET
|
||
contentType = contentType.toLowerCase() | ||
|
||
if (contentType.startsWith('text/')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason why we can't move these to a single condition?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like how each of the conditions is its own case, à la "if it's a text, don't encode; if it's another content-type encoded as json or xml, don't encode; here's a set of exceptions we don't encode". Moving them into a single condition would make that grouping harder to see. Can you elaborate on why we should move them into a single condition?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally, I think having 3 termination points when you can have 1 makes it harder to trace and debug. I also don't see how having a single condition makes the grouping harder to see. It's not a big deal though, and I respect the personal preference if you think it adds more clarity.
Co-authored-by: Eduardo Bouças <mail@eduardoboucas.com>
Turns out I inadvertently tried to fix this in #3564 😅, this PR should supersede that I think. |
Summary
Fixes #3315
Updates the CLI's decision logic for encoding incoming requests as base64 or not, to better match what Netlify production infrastructure is doing.
For us to review and ship your PR efficiently, please perform the following steps:
passes our tests.
A picture of a cute animal (not mandatory, but encouraged)