🐛 Only send response if not already sent
This commit is contained in:
parent
644fbe5fa5
commit
119d73aae1
1 changed files with 3 additions and 2 deletions
|
|
@ -55,7 +55,8 @@ func ErrorMiddleware(opts ...Option) gin.HandlerFunc {
|
|||
|
||||
c.Set("rendered_error", re)
|
||||
|
||||
// @todo check a response hasn't already been sent
|
||||
c.JSON(re.Status(), re)
|
||||
if !c.Writer.Written() {
|
||||
c.JSON(re.Status(), re)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue