Skip to content

Commit

Permalink
[Refactor] Replace Hard-Coded HTTP Values with Constants (#2702)
Browse files Browse the repository at this point in the history
  • Loading branch information
simotw authored Jan 3, 2025
1 parent f0ff2c1 commit 542f246
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions experimental/pkg/httpproxy/support.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type authorization struct {

// Create Unauthorized response
func WriteUnauthorisedResponse(w http.ResponseWriter) {
w.WriteHeader(401)
w.WriteHeader(http.StatusUnauthorized)
_, err := w.Write([]byte("Unauthorized\n"))
if err != nil {
klog.Info("failed writing unauthorized response ", err)
Expand All @@ -27,7 +27,7 @@ func WriteUnauthorisedResponse(w http.ResponseWriter) {

// Create bad request response
func WriteBadRequestResponse(w http.ResponseWriter) {
w.WriteHeader(400)
w.WriteHeader(http.StatusBadRequest)
_, err := w.Write([]byte("Bad Request\n"))
if err != nil {
klog.Info("failed writing bad request response ", err)
Expand All @@ -36,7 +36,7 @@ func WriteBadRequestResponse(w http.ResponseWriter) {

// Create internal error response
func WriteInternalErrorResponse(w http.ResponseWriter) {
w.WriteHeader(500)
w.WriteHeader(http.StatusInternalServerError)
_, err := w.Write([]byte("Internal Server Error\n"))
if err != nil {
klog.Info("failed writing internal error response ", err)
Expand Down

0 comments on commit 542f246

Please sign in to comment.