Skip to content

Commit

Permalink
Fix redirect after login
Browse files Browse the repository at this point in the history
The redirect caused the browser to be redirected to '/', but they were issueing POST requests instead of GET.
  • Loading branch information
ccremer committed Nov 10, 2021
1 parent 90308e9 commit 2ea4d9d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/web/session_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func (s Server) Login() http.Handler {
HttpOnly: true,
Secure: true,
})
http.Redirect(w, r, "/", http.StatusTemporaryRedirect)
http.Redirect(w, r, "/", http.StatusFound)
})
}

Expand Down
4 changes: 2 additions & 2 deletions test/session_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ func TestLoginSuccess(t *testing.T) {
res := httptest.NewRecorder()
newServer(odooMock.URL).ServeHTTP(res, req)

is.Equal(res.Code, http.StatusTemporaryRedirect) // HTTP status
is.Equal(res.Header().Get("Location"), "/") // Location header
is.Equal(res.Code, http.StatusFound) // HTTP status
is.Equal(res.Header().Get("Location"), "/") // Location header

is.Equal(1, len(res.Result().Cookies())) // number of cookies
c := res.Result().Cookies()[0]
Expand Down

0 comments on commit 2ea4d9d

Please sign in to comment.