Skip to content

Commit

Permalink
pipeline/authz: Add Content-Type header in the call to Keto (#290)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sbou authored and aeneasr committed Oct 30, 2019
1 parent c41ecd4 commit 1910bbe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions pipeline/authz/keto_engine_acp_ory.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ func (a *AuthorizerKetoEngineACPORY) Authorize(r *http.Request, session *authn.A
}

req, err := http.NewRequest("POST", urlx.AppendPaths(baseURL, "/engines/acp/ory", flavor, "/allowed").String(), &b)
req.Header.Add("Content-Type", "application/json")
if err != nil {
return errors.WithStack(err)
}
Expand Down
2 changes: 2 additions & 0 deletions pipeline/authz/keto_engine_acp_ory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ func TestAuthorizerKetoWarden(t *testing.T) {
r: &http.Request{URL: &url.URL{}},
setup: func(t *testing.T) *httptest.Server {
return httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
assert.Contains(t, r.Header, "Content-Type")
assert.Contains(t, r.Header["Content-Type"], "application/json")
assert.Contains(t, r.URL.Path, "exact")
w.Write([]byte(`{"allowed":false}`))
}))
Expand Down

0 comments on commit 1910bbe

Please sign in to comment.