Skip to content

[Feature] Add out-of-the-box compression support to Tapir #2878

Open
@liosedhel

Description

@liosedhel

It would be great if Tapir supported out-of-the-box compressions.

If the client's request indicates the understanding of some compression algorithms through Accept-Encoding header:

GET /encrypted-area HTTP/1.1
Host: www.example.com
Accept-Encoding: gzip, deflate

The server can respond with, for example, gzip response indicated by Content-Encoding:

HTTP/1.1 200 OK
Date: mon, 26 June 2016 22:38:34 GMT
Server: Apache/1.3.3.7 (Unix)  (Red-Hat/Linux)
Last-Modified: Wed, 08 Jan 2003 23:11:55 GMT
Accept-Ranges: bytes
Content-Length: 438
Connection: close
Content-Type: text/html; charset=UTF-8
Content-Encoding: gzip

The Tapir endpoint definition should probably contain information about which compression algorithm is supported and which is preferred (?).
Servers like akka-http can support some of the compression mechanisms, see although it has to be manually incorporated to existing routes with encodeResponse directive. The same can be achieved in Netty through ChannelPipeline HttpContentCompressor step.

Thank you for this feature request consideration! ;)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions