Skip to content

Commit

Permalink
Merge pull request #218 from go-pkgz/paskal/plain_text
Browse files Browse the repository at this point in the history
Fix Content-Type at /logout endpoint
  • Loading branch information
umputun authored Sep 19, 2024
2 parents d5ed87f + 9e446b8 commit 458e57e
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 458e57e

Please sign in to comment.