Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyResponseCompression ¶
func ApplyResponseCompression(router *gin.Engine, cmp *config.Compression)
ApplyResponseCompression applies the first available compression algorithm from the config, with a sensible fallback.
func DecompressBrRequestMiddleware ¶
func DecompressBrRequestMiddleware(cfg config.File) gin.HandlerFunc
DecompressBrRequestMiddleware returns a middleware that decompresses HTTP requests with brotli Content-Encoding. It checks if the request has a Content-Encoding header with value "br"/"brotli" and if so, replaces the request body with a decompressed version and clears the encoding header.
func DecompressRequestMiddleware ¶
func DecompressRequestMiddleware(cfg config.File) gin.HandlerFunc
DecompressRequestMiddleware returns a middleware that decompresses HTTP requests with gzip Content-Encoding. If Content-Encoding is "gzip", it replaces the request body with a gzip reader and removes encoding/length headers.
func DecompressZstdRequestMiddleware ¶
func DecompressZstdRequestMiddleware(cfg config.File) gin.HandlerFunc
DecompressZstdRequestMiddleware returns a middleware that decompresses HTTP requests with zstd Content-Encoding. It checks if the request has a Content-Encoding header with value "zstd"/"zst" and if so, replaces the request body with a decompressed version and clears the encoding header.
Types ¶
This section is empty.