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

refactor: simplify encoding negotiation logic #213

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bjohansebas
Copy link
Member

I have found a better way to handle the enforce encoding

@bjohansebas bjohansebas force-pushed the refactor branch 2 times, most recently from 5fa2552 to 0d73b37 Compare January 14, 2025 20:07
Copy link
Member

@wesleytodd wesleytodd left a comment

Choose a reason for hiding this comment

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

This kind of simplification is what I was thinking of when I was commenting in the original PR, but I think it can be done without mocking the request object. Let me know if I am missing something as I didn't do much more than read this PR to ensure that would work.

index.js Outdated Show resolved Hide resolved
@bjohansebas
Copy link
Member Author

I forgot about the legacy support for Node.js :c

Copy link
Member

@wesleytodd wesleytodd left a comment

Choose a reason for hiding this comment

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

Yeah, I like this a lot better. We should see about getting a few more eyes on it, but seems like a great improvement to land before we publish.

@IamLizu
Copy link
Member

IamLizu commented Jan 18, 2025

Hey @bjohansebas 👋

This looks clean to me. However, before pressing the approve thingy I need to clear a confusion. Previously it would apply gzip when enforceEncoding was *. But now, it doesn't compress at all on *.

It appears that we are introducing a huge change in the behavior of compression.

While I am okay with the change, I request a reference to an ADR that propose (accepted) / state in behavior change. Or perhaps it was agreed in a meeting? Sorry, I am still unable to attend the meetings.

@bjohansebas
Copy link
Member Author

@IamLizu It is not really considered a breaking change yet since it has not been released to npm, so this change can still be made.

All the discussion has been offline, as you can see in the comments on this PR and the previous one.

@IamLizu
Copy link
Member

IamLizu commented Jan 18, 2025

Thanks for clarifying! I went through the comments on this PR (sorry, missing the reference for previous one), but I didn’t see anything about the behavior change for enforceEncoding with *.

I’m totally on board with the direction of the change, but since it’s a pretty big shift in behavior, it’d be super helpful to have it documented somewhere—maybe an ADR or even just a quick summary here in the thread. That way, we have something to point to later, especially for folks like me who weren’t part of the offline discussions.

What do you think?

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.

4 participants