Skip to content
Myr

README.md

This file

Path

examples/compression/README.md

32 lines · 706 bytes · Markdown

Last changed by

Not known.

History of this file

Take it

The walk stopped after 200 commits: lines older than dcbcf5c point at it.

axum-extra: Make typed-routing feature enable routing feature (#3514)tottotobefore adoptiondcbcf5c

lines 1–32why, one step back
1# compression
23This example shows how to:4- automatically decompress request bodies when necessary5- compress response bodies based on the `accept` header.67## Running89```10cargo run -p example-compression11```1213## Sending compressed requests1415```16curl -v -g 'http://localhost:3000/' \17 -H "Content-Type: application/json" \18 -H "Content-Encoding: gzip" \19 --compressed \20 --data-binary @data/products.json.gz21```2223(Notice the `Content-Encoding: gzip` in the request, and `content-encoding: gzip` in the response.)2425## Sending uncompressed requests2627```28curl -v -g 'http://localhost:3000/' \29 -H "Content-Type: application/json" \30 --compressed \31 --data-binary @data/products.json32```