Skip to content

Commit

Permalink
reply with status unauthorized when serving login page
Browse files Browse the repository at this point in the history
  • Loading branch information
psycofdj committed Mar 13, 2021
1 parent fec61b2 commit 4e1c06a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions auth_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ func (a AuthHandler) loginPage(w http.ResponseWriter, req *http.Request) {
return
}
if req.Method == http.MethodGet {
w.WriteHeader(http.StatusUnauthorized)
w.Write([]byte(makeLoginPageHtml(
loginPageTemplate,
strings.Title(a.aggrRoute.Name),
Expand Down
2 changes: 1 addition & 1 deletion auth_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ var _ = Describe("AuthHandler", func() {

authHandler.ServeHTTP(respRecorder, req)

Expect(respRecorder.Code).To(Equal(http.StatusOK))
Expect(respRecorder.Code).To(Equal(http.StatusUnauthorized))
Expect(respRecorder.Body.String()).To(Equal("Test: /"))
})
When("Post username and password from login page", func() {
Expand Down

0 comments on commit 4e1c06a

Please sign in to comment.