Skip to content

Commit ecc97e0

Browse files
cstocktonChris Stockton
andauthored
fix: remove requirement of empty content-type on 204 (#2128)
Don't require the omission of a content-type header for a 204 response to be respected. Co-authored-by: Chris Stockton <[email protected]>
1 parent 9f22682 commit ecc97e0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

internal/hooks/hookshttp/hookshttp.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,12 +185,12 @@ func (o *Dispatcher) runHTTPHook(
185185
defer rsp.Body.Close()
186186

187187
switch rsp.StatusCode {
188-
case http.StatusOK, http.StatusNoContent, http.StatusAccepted:
188+
case http.StatusNoContent:
189+
return nil, nil
190+
191+
case http.StatusOK, http.StatusAccepted:
189192
contentType := rsp.Header.Get("Content-Type")
190193
if contentType == "" {
191-
if rsp.StatusCode == http.StatusNoContent {
192-
return nil, nil
193-
}
194194
return nil, apierrors.NewBadRequestError(
195195
apierrors.ErrorCodeHookPayloadInvalidContentType,
196196
"Invalid Content-Type: Missing Content-Type header")

0 commit comments

Comments
 (0)