-
-
Notifications
You must be signed in to change notification settings - Fork 638
[compression] Add preferred compressors list #2427
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
Conversation
7c26bf0 to
3dc338b
Compare
182bcb5 to
7fc1994
Compare
|
I tried to add some tests, but I am unable to fix these tests that are failing: Basically I set the preferred list to this: so GZIP is preferred over Brotli, but for some reason I am getting Brotli as response (even when the request is send with both gzip and br), is the findMatchingCompressor function that I edited in JettyPrecompressingResourceHandler.kt being called for this test? Could you help me fixing this one? |
Hi @fabiobento512 - it looks like you only added this for precompressed files, I think you are probably testing this for "live" compression in your tests. |
Thank you! That was it! The tests that I initially mentioned are now passing. Please have a look at all the changes and see if there is still something else that needs work. 🙂 |
|
@fabiobento512 looks good ! There is a bit of duplication here, could you rewrite to remove it? |
2aedbde to
34362ce
Compare
34362ce to
f91b2b3
Compare
Thanks! I have now tried to remove the code duplication. Please check if it is ok (I moved a common function to the CompressionStrategy class). |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #2427 +/- ##
============================================
- Coverage 86.47% 86.47% -0.01%
- Complexity 1432 1437 +5
============================================
Files 147 147
Lines 4600 4607 +7
Branches 479 481 +2
============================================
+ Hits 3978 3984 +6
Misses 404 404
- Partials 218 219 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Looks great, thank you very much @fabiobento512 - this will be part of Javalin 7! |
I was missing a way to select a preferred compression type server side. Currently the first compression type supported by both the client and the server is selected, usually browsers send brotli as last, which resulted in gzip to always be favored over it.
I added a new List that allows us to specify our preference on the server side by priority (according to the order of the elements in the list).
I never programmed in Kotlin and it's my first contribution to this project, so please guide me how to get the pull request ready to merge.