Bug-15430 change timeout errror code to 408 (#15552)

This commit is contained in:
Sharon Katz 2023-12-11 12:34:59 -05:00 committed by GitHub
parent 9236a19342
commit da755ea2ea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View file

@ -0,0 +1 @@
- POST /api/v1/fleet/scripts/run/sync timeout (longer than 60 seconds) will now return error code: 408 instead of 504

View file

@ -64,7 +64,11 @@ type runScriptSyncResponse struct {
func (r runScriptSyncResponse) error() error { return r.Err }
func (r runScriptSyncResponse) Status() int {
if r.HostTimeout {
return http.StatusGatewayTimeout
// The more proper response for a timeout on the server would be: StatusGatewayTimeout = 504
// However, as described in https://github.com/fleetdm/fleet/issues/15430 we will send:
// StatusRequestTimeout = 408 // RFC 9110, 15.5.9
// See: https://github.com/fleetdm/fleet/issues/15430#issuecomment-1847345617
return http.StatusRequestTimeout
}
return http.StatusOK
}