next.js
76ce27dd - Patch compression to assign its response methods by name

Commit
22 days ago
Patch compression to assign its response methods by name The patch of the `compression` middleware added earlier on this branch moved the four functions it assigns to the response per request (`flush`, `write`, `end`, `on`) to module level and bound them to a state object. Bound functions are not the same as the originals: their names are `bound flush` and so on, and `this` inside them is always the response the middleware was called with, so `on` returned that response where the original returned its receiver, which differs when the response is wrapped in a `Proxy`. The patch now turns the four function expressions into function declarations inside the middleware and assigns them by name. The functions are the originals: same code, names, lengths, `this` and return values. What the patch is for is unchanged: a function that is not a literal on the right-hand side of the property assignment is not allocated in the old generation. `src/compiled/compression` is regenerated with `taskr ncc_compression`.
Author
Committer
Parents
Loading