Closed WisperDin closed 11 months ago
We ran into the same issue when implementing the timeout middleware on one of our services.
While -1
is obviously not a valid status code and you could see this an issue with gin itself, I think this library should handle that case, too.
So maybe we can just allow a code == -1
in writer.go?
Have exactly the same issue.
I fell into the same issue when returning SSEvent. https://github.com/gin-gonic/gin/blob/v1.9.1/context.go#L1073-L1078
redirect handler like that:
panic when calling c.Render, because the call carries the parameter code=-1
Panic when calling
WriteHeader
because timeout middleware rewrites the writerhttps://github.com/gin-contrib/timeout/blob/7e229ecbcfb14762a93e6d7b4938ba31b78a85d8/writer.go#L41
https://github.com/gin-contrib/timeout/blob/7e229ecbcfb14762a93e6d7b4938ba31b78a85d8/writer.go#L75