Tinkex.API.Compression (Tinkex v0.3.4)
View SourceResponse compression handling for Tinkex API.
Handles gzip decompression and content-encoding header management.
Summary
Functions
Decompresses a Finch response if it's gzip-encoded.
Functions
@spec decompress(Finch.Response.t()) :: Finch.Response.t()
Decompresses a Finch response if it's gzip-encoded.
Checks the content-encoding header and decompresses the body if it's gzip. Strips the content-encoding header after decompression.
Examples
iex> response = %Finch.Response{
...> body: :zlib.gzip("test"),
...> headers: [{"content-encoding", "gzip"}]
...> }
iex> decompressed = decompress(response)
iex> decompressed.body
"test"