Skip to content

Commit

Permalink
fix: Use variables instead of ints for HTTP statuses
Browse files Browse the repository at this point in the history
  • Loading branch information
nsklikas committed Aug 31, 2023
1 parent 3deebc4 commit 9332221
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/kratos/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func (a *API) handleCreateFlow(w http.ResponseWriter, r *http.Request) {
return
}
setCookies(w, cookies)
w.WriteHeader(200)
w.WriteHeader(http.StatusOK)
w.Write(resp)
}

Expand All @@ -108,7 +108,7 @@ func (a *API) handleGetLoginFlow(w http.ResponseWriter, r *http.Request) {
return
}
setCookies(w, cookies)
w.WriteHeader(200)
w.WriteHeader(http.StatusOK)
w.Write(resp)
}

Expand Down Expand Up @@ -139,7 +139,7 @@ func (a *API) handleUpdateFlow(w http.ResponseWriter, r *http.Request) {
setCookies(w, cookies)
// Kratos returns us a '422' response but we tranform it to a '200',
// because this is the expected behavior for us.
w.WriteHeader(200)
w.WriteHeader(http.StatusOK)
w.Write(resp)
}

Expand All @@ -162,7 +162,7 @@ func (a *API) handleKratosError(w http.ResponseWriter, r *http.Request) {
return
}
setCookies(w, cookies)
w.WriteHeader(200)
w.WriteHeader(http.StatusOK)

Check warning on line 165 in pkg/kratos/handlers.go

View check run for this annotation

Codecov / codecov/patch

pkg/kratos/handlers.go#L165

Added line #L165 was not covered by tests
w.Write(resp)
}

Expand Down

0 comments on commit 9332221

Please sign in to comment.