Skip to content

Commit

Permalink
Add test for fragment - not working as expected
Browse files Browse the repository at this point in the history
Signed-off-by: Pushpalanka Jayawardhana <[email protected]>
  • Loading branch information
Pushpalanka committed Nov 25, 2024
1 parent 25ac259 commit 3d2bfe9
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,20 @@ func TestAuthorizeRequestFilterOnRequestURL(t *testing.T) {
backendHeaders: make(http.Header),
removeHeaders: make(http.Header),
},
{
msg: "Allow Requests with an empty query string and fragment",
filterName: "opaAuthorizeRequest",
bundleName: "somebundle.tar.gz",
regoQuery: "envoy/authz/allow_with_path_having_fragment_empty_query",
requestPath: "/path-with-empty-query#fragment?",
requestMethod: "GET",
contextExtensions: "",
expectedStatus: http.StatusOK,
expectedBody: "Welcome!",
expectedHeaders: make(http.Header),
backendHeaders: make(http.Header),
removeHeaders: make(http.Header),
},
{
msg: "Simple Forbidden with Query Parameters",
filterName: "opaAuthorizeRequest",
Expand Down Expand Up @@ -467,6 +481,10 @@ func TestAuthorizeRequestFilterOnRequestURL(t *testing.T) {
input.parsed_query == {}
}
allow_with_path_having_fragment_empty_query {
input.attributes.request.http.headers.[":path"] == "/path-with-empty-query#fragment"
}
allow {
input.parsed_path == [ "allow-with-query" ]
input.parsed_query.pass == ["yes"]
Expand Down

0 comments on commit 3d2bfe9

Please sign in to comment.