Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adds method matching check to rewrite url captures policy #1253

Merged
merged 5 commits into from
Jan 20, 2021

Conversation

kevprice83
Copy link
Member

Adds a list of methods to the transformation. Checks the request method against the method configured in the policy just as it is done in the URL rewrite policy.

Fixes: THREESCALE-6270

@kevprice83 kevprice83 requested a review from a team as a code owner January 18, 2021 14:26
@kevprice83 kevprice83 changed the title adds method matching check to rewrite url captures policy [WIP] adds method matching check to rewrite url captures policy Jan 18, 2021
@kevprice83 kevprice83 changed the title [WIP] adds method matching check to rewrite url captures policy adds method matching check to rewrite url captures policy Jan 20, 2021
-- Returns true if no Method is provided in the config for backwardscompatibility
local function is_match_methods(methods)

local request_method = ngx.req.get_method()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would move this line after the condition, but it's ok if you want to keep it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah yes makes sense, not using it in the conditional statement anyway, thanks

@@ -233,3 +233,51 @@ yay, api backend
--- error_code: 200
--- no_error_log
[error]

=== TEST 5: one transformation with method that doesn't match
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add two test that match at least one method:

Test6: One single method works.
Test7: Array with methods [POST, UPDATE, GET] will match if GET method is in there. (Want to check the next method of the array is working)

@eloycoto eloycoto merged commit 9c1c7ed into master Jan 20, 2021
@eguzki eguzki deleted the kevprice-THREESCALE-6270 branch October 23, 2023 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants