Skip to content

Commit

Permalink
broken token test case
Browse files Browse the repository at this point in the history
  • Loading branch information
alessandroMiceli committed Jun 2, 2021
1 parent bcf5257 commit 4223b69
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions http/middleware/response_header_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,17 @@ func TestClientID(t *testing.T) {
assert.Empty(t, rec.Header().Get(ClientIDHeaderName))
})

t.Run("brokenToken", func(t *testing.T) {
rec := httptest.NewRecorder()
req := httptest.NewRequest(http.MethodGet, "/", nil)
req.Header.Set("Authorization", fmt.Sprintf("Bearer %v", emptyToken+"broken"))

h := ClientID(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
}))
h.ServeHTTP(rec, req)
assert.Empty(t, rec.Header().Get(ClientIDHeaderName))
})

t.Run("clientID", func(t *testing.T) {
rec := httptest.NewRecorder()
req := httptest.NewRequest(http.MethodGet, "/", nil)
Expand Down

0 comments on commit 4223b69

Please sign in to comment.