-
-
Notifications
You must be signed in to change notification settings - Fork 46
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
Feature\#89 - Per route options for compression #92
Conversation
Expanded the test suite to handle per route tests. Updated to decorate properly with different routes.
Feature for #89. Took a first pass at this welcome feedback on it. In particular:
|
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.
Great!
package.json
Outdated
@@ -23,7 +24,7 @@ | |||
"@types/node": "^12.0.8", | |||
"@typescript-eslint/parser": "^2.0.0", | |||
"eslint-plugin-typescript": "^0.14.0", | |||
"fastify": "^2.0.0", | |||
"fastify": "fastify/fastify#master", |
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.
It should be released in 2.11 👍
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.
Done, thanks
Can you bump this to fastify v2.11? That's the one you'll need for this fix. |
(this will be a semver-major change). |
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.
Good work! Don't forget to change
Line 250 in b2a1995
fastify: '>=1.3.0', |
index.js
Outdated
} | ||
|
||
next() | ||
function onRequest (req, reply, next) { | ||
reply.compress = compress(params) |
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.
Given that params
will not change, can you cache the output of compress(params)
outside of the onRequest
hook?
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.
👍
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.
LGTM
Checklist
npm run test
andnpm run benchmark