https://github.com/dbernheisel/mint_decompression_example
Example of using Mint and decompressing responses
https://github.com/dbernheisel/mint_decompression_example
Last synced: about 1 year ago
JSON representation
Example of using Mint and decompressing responses
- Host: GitHub
- URL: https://github.com/dbernheisel/mint_decompression_example
- Owner: dbernheisel
- Created: 2019-07-10T22:33:30.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-07-12T18:53:33.000Z (over 6 years ago)
- Last Synced: 2025-01-23T01:31:22.814Z (about 1 year ago)
- Language: Elixir
- Size: 8.79 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# MintDecompression
This serves as an example of how to decompress data using Elixir's
[Mint](https://github.com/ericmj/mint) library
It starts by using the architecture from Mint's guide:
https://github.com/ericmj/mint/blob/d782ed6aaa9d6150a2569d6c77a2c81e5d6b32ec/pages/Architecture.md
It's then modified:
1) when Mint is done with the request, look for a content-encoding header
2) with that header, try to decompress the body
3) return the decompressed body instead of the original binary body
This starts with `process_response({:done, request_ref}, state)` clause, and
then uses `decompress_data/2` and `find_content_encoding/1`