-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
fix(proxy-cache): allow nil ctx vars in cache key #7168
Conversation
Hi @worldwonderer , thank you for your contribution. The test case is wrongly written.
will not hit you can ref to: https://github.com/apache/apisix/blob/master/t/plugin/proxy-cache/disk.t#L318-L367 |
Thanks for your reminder. I understand the usage of test cases now. First, request /t will create route and request /hello will goto the created route? I pushed new commit, plz trigger CI and try again. |
t/plugin/proxy-cache/disk.t
Outdated
} | ||
--- request | ||
GET /t | ||
--- error_code: 200 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can remove this, it will be checked by default
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just keep this?
--- response_body
passed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this cause CI fail? https://github.com/apache/apisix/runs/6667981777?check_suite_focus=true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strange, removing it shouldn't affect anything. I will check it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tried it locally, no exceptions, you can delete -- error_code: 200
@@ -53,6 +53,8 @@ The cache expiration time cannot be configured dynamically. It can only be set b | |||
|
|||
If the Upstream service is not available and APISIX returns a 502 or 504 status code, it will be cached for 10s. | |||
|
|||
Variable starts with `$` and will be treated as an empty string when does not exist. You can also use a combination of variables and strings, but you need to write them separately in one array, and eventually the variables will be parsed and stitched together with strings. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Variable starts with `$` and will be treated as an empty string when does not exist. You can also use a combination of variables and strings, but you need to write them separately in one array, and eventually the variables will be parsed and stitched together with strings. | |
Variables (start with `$`) can be specified in `cache_key` and `cache_bypass. It's worth to mention that the variable value will be an empty string if it doesn't exist. | |
You can also combine a number of variables and strings (constants), by writing them into an array, eventually, variables will be parsed and stitched together with strings. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed. And I added no_cache
LGTM, let's wait for the CI pass. |
Signed-off-by: spacewander <spacewanderlzx@gmail.com>
Signed-off-by: spacewander <spacewanderlzx@gmail.com>
Hi @worldwonderer , thanks for the contribution! Here is the Contributor T-shirt form[1], if you're interested, kindly take a look :) [1] https://github.com/apache/apisix/blob/master/CONTRIBUTING.md#contributor-t-shirt |
Description
if proxy-cache plugin configures cache_key with ["$arg_a", "$arg_b"] and $arg_a and $arg_b are both nil, apisix will abort with error.
Fixes #7167
Checklist