You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/06/01 02:29:44 UTC

[GitHub] [apisix] worldwonderer commented on a diff in pull request #7168: fix(proxy-cache): allow nil ctx vars in cache key

worldwonderer commented on code in PR #7168:
URL: https://github.com/apache/apisix/pull/7168#discussion_r886268773


##########
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:
   nice suggestion, changed



-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org