Description

I expected gzip and deflate and other types to be automatically handed, for some reason, or at least have a common middleware that would handle this. Is this not the case?

How to reproduce

package main

import (
    "github.com/gin-gonic/gin"
)

func main() {
    g := gin.Default()
    g.POST("/json", func(c *gin.Context) {
        var messages []string
        if err := c.ShouldBindJSON(&messages); err != nil {
            c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
                        return
                }

    })
    g.Run(":9000")
}

And now send it compressed requests.

Expectations

I should be able to send compressed data and have it automatically uncompressed.

Actual result

Environment

  • go version: 1.22.2
  • gin version (or commit ref): github.com/gin-gonic/gin v1.9.1
  • operating system: linux, Darwin

Comment From: RedCrazyGhost

This requires you to handle the client-side and server-side code yourself. The data has been compressed during network transmission. This issue can be moved to https://github.com/gin-gonic/contrib for questioning https://github.com/rickb777/servefiles Maybe this is to want you.