Skip to content

Commit d7c2ef2

Browse files
committed
fix merge
1 parent bb5aa3e commit d7c2ef2

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

coderd/workspaceagents.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -698,20 +698,20 @@ func (api *API) workspaceAgentReportStats(rw http.ResponseWriter, r *http.Reques
698698
func (api *API) postWorkspaceAppHealth(rw http.ResponseWriter, r *http.Request) {
699699
workspaceAgent := httpmw.WorkspaceAgent(r)
700700
var req codersdk.PostWorkspaceAppHealthsRequest
701-
if !httpapi.Read(rw, r, &req) {
701+
if !httpapi.Read(r.Context(), rw, r, &req) {
702702
return
703703
}
704704

705705
if req.Healths == nil || len(req.Healths) == 0 {
706-
httpapi.Write(rw, http.StatusBadRequest, codersdk.Response{
706+
httpapi.Write(r.Context(), rw, http.StatusBadRequest, codersdk.Response{
707707
Message: "Health field is empty",
708708
})
709709
return
710710
}
711711

712712
apps, err := api.Database.GetWorkspaceAppsByAgentID(r.Context(), workspaceAgent.ID)
713713
if err != nil {
714-
httpapi.Write(rw, http.StatusInternalServerError, codersdk.Response{
714+
httpapi.Write(r.Context(), rw, http.StatusInternalServerError, codersdk.Response{
715715
Message: "Error getting agent apps",
716716
Detail: err.Error(),
717717
})
@@ -730,15 +730,15 @@ func (api *API) postWorkspaceAppHealth(rw http.ResponseWriter, r *http.Request)
730730
return nil
731731
}()
732732
if old == nil {
733-
httpapi.Write(rw, http.StatusNotFound, codersdk.Response{
733+
httpapi.Write(r.Context(), rw, http.StatusNotFound, codersdk.Response{
734734
Message: "Error setting workspace app health",
735735
Detail: xerrors.Errorf("workspace app name %s not found", name).Error(),
736736
})
737737
return
738738
}
739739

740740
if old.HealthcheckUrl == "" {
741-
httpapi.Write(rw, http.StatusNotFound, codersdk.Response{
741+
httpapi.Write(r.Context(), rw, http.StatusNotFound, codersdk.Response{
742742
Message: "Error setting workspace app health",
743743
Detail: xerrors.Errorf("health checking is disabled for workspace app %s", name).Error(),
744744
})
@@ -750,7 +750,7 @@ func (api *API) postWorkspaceAppHealth(rw http.ResponseWriter, r *http.Request)
750750
case codersdk.WorkspaceAppHealthHealthy:
751751
case codersdk.WorkspaceAppHealthUnhealthy:
752752
default:
753-
httpapi.Write(rw, http.StatusBadRequest, codersdk.Response{
753+
httpapi.Write(r.Context(), rw, http.StatusBadRequest, codersdk.Response{
754754
Message: "Error setting workspace app health",
755755
Detail: xerrors.Errorf("workspace app health %s is not a valid value", newHealth).Error(),
756756
})
@@ -772,15 +772,15 @@ func (api *API) postWorkspaceAppHealth(rw http.ResponseWriter, r *http.Request)
772772
Health: app.Health,
773773
})
774774
if err != nil {
775-
httpapi.Write(rw, http.StatusInternalServerError, codersdk.Response{
775+
httpapi.Write(r.Context(), rw, http.StatusInternalServerError, codersdk.Response{
776776
Message: "Error setting workspace app health",
777777
Detail: err.Error(),
778778
})
779779
return
780780
}
781781
}
782782

783-
httpapi.Write(rw, http.StatusOK, nil)
783+
httpapi.Write(r.Context(), rw, http.StatusOK, nil)
784784
}
785785

786786
// wsNetConn wraps net.Conn created by websocket.NetConn(). Cancel func

0 commit comments

Comments
 (0)