tzssangglass commented on code in PR #7168:
URL: https://github.com/apache/apisix/pull/7168#discussion_r886262698
##########
t/plugin/proxy-cache/disk.t:
##########
@@ -707,3 +707,54 @@ GET /t
--- error_code: 400
--- response_body eval
qr/failed to check the configuration of plugin proxy-cache err/
+
+
+
+=== TEST 28: nil vars for cache_key
+--- config
+ location /t {
+ content_by_lua_block {
+ local t = require("lib.test_admin").test
+ local code, body = t('/apisix/admin/routes/1',
+ ngx.HTTP_PUT,
+ [[{
+ "plugins": {
+ "proxy-cache": {
+ "cache_key": ["$arg_foo", "$arg_bar",
"$arg_baz"],
+ "cache_zone": "disk_cache_one",
+ "cache_bypass": ["$arg_bypass"],
+ "cache_method": ["GET"],
+ "cache_http_status": [200],
+ "hide_cache_headers": true,
+ "no_cache": ["$arg_no_cache"]
+ }
+ },
+ "upstream": {
+ "nodes": {
+ "127.0.0.1:1986": 1
+ },
+ "type": "roundrobin"
+ },
+ "uri": "/hello"
+ }]]
+ )
+
+ if code >= 300 then
+ ngx.status = code
+ end
+ ngx.say(body)
+ }
+ }
+--- request
+GET /t
+--- error_code: 200
+--- response_body
+passed
+
+
+
+=== TEST 29: hit route with nil vars in cache_key
+--- request
+GET /hello
Review Comment:
```suggestion
GET /hello?bar=a
```
at least that's what will trigger the exception you're trying to fix.
you can verify that just `GET /hello`, even if you delete the `or ""` you
added, will not trigger an exception.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]