mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: trace httpapi.{Read,Write} (#4134)
This commit is contained in:
+2
-2
@@ -23,7 +23,7 @@ func (api *API) logReportCSPViolations(rw http.ResponseWriter, r *http.Request)
|
||||
err := dec.Decode(&v)
|
||||
if err != nil {
|
||||
api.Logger.Warn(ctx, "csp violation", slog.Error(err))
|
||||
httpapi.Write(rw, http.StatusBadRequest, codersdk.Response{
|
||||
httpapi.Write(ctx, rw, http.StatusBadRequest, codersdk.Response{
|
||||
Message: "Failed to read body, invalid json.",
|
||||
Detail: err.Error(),
|
||||
})
|
||||
@@ -36,5 +36,5 @@ func (api *API) logReportCSPViolations(rw http.ResponseWriter, r *http.Request)
|
||||
}
|
||||
api.Logger.Warn(ctx, "csp violation", fields...)
|
||||
|
||||
httpapi.Write(rw, http.StatusOK, "ok")
|
||||
httpapi.Write(ctx, rw, http.StatusOK, "ok")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user