Skip to content

Commit

Permalink
Change Content-Type to plain text for logout and reset endpoints
Browse files Browse the repository at this point in the history
No text is returned so the response is not a valid JSON.
  • Loading branch information
paskal committed Sep 19, 2024
1 parent d5ed87f commit 9e446b8
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ func TestLogout(t *testing.T) {
resp, err = client.Get("http://127.0.0.1:8089/auth/logout")
require.Nil(t, err)
assert.Equal(t, 200, resp.StatusCode)
assert.Equal(t, "application/json; charset=utf-8", resp.Header.Get("Content-Type"))
assert.Equal(t, "text/plain; charset=utf-8", resp.Header.Get("Content-Type"))
defer resp.Body.Close()

resp, err = client.Get("http://127.0.0.1:8089/private")
Expand Down
2 changes: 1 addition & 1 deletion token/jwt.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ func (j *Service) Reset(w http.ResponseWriter) {
MaxAge: -1, Expires: time.Unix(0, 0), Secure: j.SecureCookies, SameSite: j.SameSite}
http.SetCookie(w, &xsrfCookie)

w.Header().Set("Content-Type", "application/json; charset=utf-8")
w.Header().Set("Content-Type", "text/plain; charset=utf-8")
}

// checkAuds verifies if claims.Audience in the list of allowed by audReader
Expand Down
2 changes: 1 addition & 1 deletion v2/auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ func TestLogout(t *testing.T) {
resp, err = client.Get("http://127.0.0.1:8089/auth/logout")
require.Nil(t, err)
assert.Equal(t, 200, resp.StatusCode)
assert.Equal(t, "application/json; charset=utf-8", resp.Header.Get("Content-Type"))
assert.Equal(t, "text/plain; charset=utf-8", resp.Header.Get("Content-Type"))
defer resp.Body.Close()

resp, err = client.Get("http://127.0.0.1:8089/private")
Expand Down
2 changes: 1 addition & 1 deletion v2/token/jwt.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ func (j *Service) Reset(w http.ResponseWriter) {
MaxAge: -1, Expires: time.Unix(0, 0), Secure: j.SecureCookies, SameSite: j.SameSite}
http.SetCookie(w, &xsrfCookie)

w.Header().Set("Content-Type", "application/json; charset=utf-8")
w.Header().Set("Content-Type", "text/plain; charset=utf-8")
}

// checkAuds verifies if claims.Audience in the list of allowed by audReader
Expand Down

0 comments on commit 9e446b8

Please sign in to comment.