Skip to content

Commit 723316d

Browse files
Update forbidden by policy to return 401
1 parent 2ee184c commit 723316d

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

  • event-gateway/gateway-runtime/internal/connectors/receiver/websub

event-gateway/gateway-runtime/internal/connectors/receiver/websub/handler.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ func (h *HubHandler) handleSubscribe(w http.ResponseWriter, r *http.Request) {
106106
return
107107
}
108108
if shortCircuited {
109-
writePolicyResponse(w, nil, http.StatusForbidden, "forbidden by policy")
109+
writePolicyResponse(w, nil, http.StatusUnauthorized, http.StatusText(http.StatusUnauthorized))
110110
return
111111
}
112112

@@ -210,7 +210,7 @@ func (h *HubHandler) handleUnsubscribe(w http.ResponseWriter, r *http.Request) {
210210
return
211211
}
212212
if shortCircuited {
213-
writePolicyResponse(w, nil, http.StatusForbidden, "forbidden by policy")
213+
writePolicyResponse(w, nil, http.StatusUnauthorized, http.StatusText(http.StatusUnauthorized))
214214
return
215215
}
216216

@@ -342,7 +342,7 @@ func (h *WebhookReceiverHandler) ServeHTTP(w http.ResponseWriter, r *http.Reques
342342
}
343343
if shortCircuited {
344344
slog.Info("Inbound request rejected by policy", "channel", channelName, "binding", h.bindingName)
345-
writePolicyResponse(w, processed, http.StatusForbidden, "forbidden by policy")
345+
writePolicyResponse(w, processed, http.StatusUnauthorized, http.StatusText(http.StatusUnauthorized))
346346
return
347347
}
348348

0 commit comments

Comments
 (0)