Skip to content

Added tower-http compression as middleware on both HTTP routers#386

Merged
josecelano merged 2 commits into
torrust:developfrom
alexohneander:develop
Aug 26, 2023
Merged

Added tower-http compression as middleware on both HTTP routers#386
josecelano merged 2 commits into
torrust:developfrom
alexohneander:develop

Conversation

@alexohneander

Copy link
Copy Markdown
Contributor

Modified:
I have added tower-http compression as middleware on both HTTP routers(API, Tracker HTTP).

All tests were run and were okay.

@josecelano josecelano linked an issue Aug 26, 2023 that may be closed by this pull request
@codecov

codecov Bot commented Aug 26, 2023

Copy link
Copy Markdown

Codecov Report

Merging #386 (22bb98a) into develop (d36d655) will increase coverage by 0.12%.
The diff coverage is 100.00%.

@@             Coverage Diff             @@
##           develop     #386      +/-   ##
===========================================
+ Coverage    83.95%   84.07%   +0.12%     
===========================================
  Files          102      102              
  Lines         7267     7185      -82     
===========================================
- Hits          6101     6041      -60     
+ Misses        1166     1144      -22     
Files Changed Coverage Δ
src/servers/apis/routes.rs 100.00% <100.00%> (ø)
src/servers/http/v1/routes.rs 100.00% <100.00%> (ø)

... and 34 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@josecelano josecelano requested a review from da2ce7 August 26, 2023 21:04

@da2ce7 da2ce7 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me. Surprisingly Simple!

@josecelano

Copy link
Copy Markdown
Member

I've tested manually with the following:

curl -I 'http://127.0.0.1:1212/api/v1/stats?token=MyAccessToken'   -H 'Cache-Control: no-cache'   -H 'Pragma: no-cache'   -H 'Accept-Encoding: gzip'
curl -raw 'http://127.0.0.1:1212/api/v1/stats?token=MyAccessToken'   -H 'Cache-Control: no-cache'   -H 'Pragma: no-cache'   -H 'Accept-Encoding: gzip' --output response.gz
gzip -d response.gz 

@josecelano

josecelano commented Aug 26, 2023

Copy link
Copy Markdown
Member

ACK 22bb98a

@josecelano josecelano merged commit 8b48b0c into torrust:develop Aug 26, 2023
@alexohneander

Copy link
Copy Markdown
Contributor Author

@josecelano It is also supported brotli

curl -I 'http://127.0.0.1:1212/api/v1/stats?token=MyAccessToken'   -H 'Cache-Control: no-cache'   -H 'Pragma: no-cache'   -H 'Accept-Encoding: br'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Add middleware to compress responses

3 participants