spacewander commented on code in PR #8206:
URL: https://github.com/apache/apisix/pull/8206#discussion_r1018693636
##########
apisix/plugins/jwt-auth.lua:
##########
@@ -188,10 +196,41 @@ function _M.check_schema(conf, schema_type)
return true
end
+local function remove_specified_cookie(src, key)
+ local cookie_key_pattern = "([a-zA-Z0-9-_]*)"
+ local cookie_val_pattern = "([a-zA-Z0-9-._]*)"
+ local t = new_tab(1, 0)
+
+ local it, err = ngx_re_gmatch(src, cookie_key_pattern .. "=" ..
cookie_val_pattern, "jo")
+ if not it then
+ core.log.error("match origins failed: ", err)
+ return nil
Review Comment:
I think of it again. Look like we need to return the src when an error
happens? Otherwise, the whole Cookie will be removed.
##########
t/plugin/jwt-auth3.t:
##########
@@ -0,0 +1,301 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+use t::APISIX 'no_plan';
+
+repeat_each(1);
+no_long_string();
+no_root_location();
+no_shuffle();
+
+add_block_preprocessor(sub {
+ my ($block) = @_;
+
+ if ((!defined $block->error_log) && (!defined $block->no_error_log)) {
+ $block->set_value("no_error_log", "[error]");
+ }
+
+ if (!defined $block->request) {
+ $block->set_value("request", "GET /t");
+ }
Review Comment:
Since we don't set `response_body` in some tests, we should provide the
default value "passed" here.
--
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]