compression

package
v1.11.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 9, 2026 License: GPL-3.0 Imports: 12 Imported by: 0

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() 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() 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() 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL