Skip to content

Commit

Permalink
fix issue ory#1136 - Authorizer "remote" throws exception "invalid Re…
Browse files Browse the repository at this point in the history
…ad on closed Body" if request body is present in request
  • Loading branch information
timthornton-avid committed Oct 18, 2023
1 parent 7e7b824 commit f4af5c5
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pipeline/authz/remote_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,16 @@ func TestAuthorizerRemoteAuthorize(t *testing.T) {
t.Errorf("Authorize() error = %v, wantErr %v", err, tt.wantErr)
}

// Issue #1136 - Authorizer "remote" throws exception "invalid Read on closed Body" if request body is present in request
// This test was added to verify that the request body is retained after the AuthorizerRemote pipeline processing.
if tt.body != "" {
processedBody, _ := io.ReadAll(r.Body)
if result := tt.body == string(processedBody); result == false {
t.Errorf("Authorize() error = payload body failure, body mismatch")
}
}
// end Issue #1136

if tt.sessionHeaderMatch != nil {
assert.Equal(t, tt.sessionHeaderMatch, &tt.session.Header)
}
Expand Down

0 comments on commit f4af5c5

Please sign in to comment.