@@ -698,20 +698,20 @@ func (api *API) workspaceAgentReportStats(rw http.ResponseWriter, r *http.Reques
698
698
func (api * API ) postWorkspaceAppHealth (rw http.ResponseWriter , r * http.Request ) {
699
699
workspaceAgent := httpmw .WorkspaceAgent (r )
700
700
var req codersdk.PostWorkspaceAppHealthsRequest
701
- if ! httpapi .Read (rw , r , & req ) {
701
+ if ! httpapi .Read (r . Context (), rw , r , & req ) {
702
702
return
703
703
}
704
704
705
705
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 {
707
707
Message : "Health field is empty" ,
708
708
})
709
709
return
710
710
}
711
711
712
712
apps , err := api .Database .GetWorkspaceAppsByAgentID (r .Context (), workspaceAgent .ID )
713
713
if err != nil {
714
- httpapi .Write (rw , http .StatusInternalServerError , codersdk.Response {
714
+ httpapi .Write (r . Context (), rw , http .StatusInternalServerError , codersdk.Response {
715
715
Message : "Error getting agent apps" ,
716
716
Detail : err .Error (),
717
717
})
@@ -730,15 +730,15 @@ func (api *API) postWorkspaceAppHealth(rw http.ResponseWriter, r *http.Request)
730
730
return nil
731
731
}()
732
732
if old == nil {
733
- httpapi .Write (rw , http .StatusNotFound , codersdk.Response {
733
+ httpapi .Write (r . Context (), rw , http .StatusNotFound , codersdk.Response {
734
734
Message : "Error setting workspace app health" ,
735
735
Detail : xerrors .Errorf ("workspace app name %s not found" , name ).Error (),
736
736
})
737
737
return
738
738
}
739
739
740
740
if old .HealthcheckUrl == "" {
741
- httpapi .Write (rw , http .StatusNotFound , codersdk.Response {
741
+ httpapi .Write (r . Context (), rw , http .StatusNotFound , codersdk.Response {
742
742
Message : "Error setting workspace app health" ,
743
743
Detail : xerrors .Errorf ("health checking is disabled for workspace app %s" , name ).Error (),
744
744
})
@@ -750,7 +750,7 @@ func (api *API) postWorkspaceAppHealth(rw http.ResponseWriter, r *http.Request)
750
750
case codersdk .WorkspaceAppHealthHealthy :
751
751
case codersdk .WorkspaceAppHealthUnhealthy :
752
752
default :
753
- httpapi .Write (rw , http .StatusBadRequest , codersdk.Response {
753
+ httpapi .Write (r . Context (), rw , http .StatusBadRequest , codersdk.Response {
754
754
Message : "Error setting workspace app health" ,
755
755
Detail : xerrors .Errorf ("workspace app health %s is not a valid value" , newHealth ).Error (),
756
756
})
@@ -772,15 +772,15 @@ func (api *API) postWorkspaceAppHealth(rw http.ResponseWriter, r *http.Request)
772
772
Health : app .Health ,
773
773
})
774
774
if err != nil {
775
- httpapi .Write (rw , http .StatusInternalServerError , codersdk.Response {
775
+ httpapi .Write (r . Context (), rw , http .StatusInternalServerError , codersdk.Response {
776
776
Message : "Error setting workspace app health" ,
777
777
Detail : err .Error (),
778
778
})
779
779
return
780
780
}
781
781
}
782
782
783
- httpapi .Write (rw , http .StatusOK , nil )
783
+ httpapi .Write (r . Context (), rw , http .StatusOK , nil )
784
784
}
785
785
786
786
// wsNetConn wraps net.Conn created by websocket.NetConn(). Cancel func
0 commit comments