Skip to content

armgit / fider

Public Imported from GitHub
0

Open platform to collect and prioritize feedback

enhancement: better log on response write

goenningbcf451a3cb02
diff --git a/app/pkg/web/context.go b/app/pkg/web/context.go
index 8f084b67c..efba1578c 100644
--- a/app/pkg/web/context.go
+++ b/app/pkg/web/context.go
@@ -469,11 +469,16 @@ func (c *Context) Blob(code int, contentType string, b []byte) error {
if code >= 400 {
c.Response.Header().Set("Cache-Control", "no-cache, no-store")
}
- c.Response.Header().Set("Content-Type", contentType)
+ c.Response.Header().Set("Content-Type", contentType)
c.Response.WriteHeader(code)
+
_, err := c.Response.Write(b)
- return err
+ if err != nil {
+ return errors.Wrap(err, "failed to write response")
+ }
+
+ return nil
}
// NoContent sends a response with no body and a status code.