Skip to content

Mishandling 404? #98

Open
Open
@rymurr

Description

@rymurr

I have a simple program

package main

import (

	"github.com/gin-contrib/gzip"
	"github.com/gin-gonic/gin"
)

func main() {
	r := gin.New()
	r.Use( gzip.Gzip(gzip.DefaultCompression))

	r.GET("/x", func(c *gin.Context) {
		c.JSON(200, gin.H{"hello": "world"})
	})
	r.Run()
}

when i do curl localhost:8080 -H 'accept-encoding: gzip' -v I get a 200 response and when I do curl localhost:8080 -v I get a 404 response.

I am not sure what I am doing wrong but it seems like the gzip buffer is being closed before gin writes its 404 which somehow messes up the eventual response object.

hitting the localhost:8080/x endpoint works fine

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions