This is an automated email from the ASF dual-hosted git repository.
shuaijinchao pushed a commit to branch master
in repository
https://gitbox.apache.org/repos/asf/apisix-python-plugin-runner.git
The following commit(s) were added to refs/heads/master by this push:
new 1498038 fix: loading fails when plugin configuration is empty (#45)
1498038 is described below
commit 149803874237e007ee52b3b65a5d2a245f13e3ea
Author: 帅进超 <[email protected]>
AuthorDate: Tue Mar 1 14:04:01 2022 +0800
fix: loading fails when plugin configuration is empty (#45)
---
apisix/runner/http/request.py | 2 +-
tests/runner/http/test_request.py | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/apisix/runner/http/request.py b/apisix/runner/http/request.py
index 9bd9703..9746252 100644
--- a/apisix/runner/http/request.py
+++ b/apisix/runner/http/request.py
@@ -333,7 +333,7 @@ class Request:
:param value:
:return:
"""
- if key and value:
+ if key:
self.__configs[key] = value
return True
return False
diff --git a/tests/runner/http/test_request.py
b/tests/runner/http/test_request.py
index bbe1402..8b22e9a 100644
--- a/tests/runner/http/test_request.py
+++ b/tests/runner/http/test_request.py
@@ -107,7 +107,8 @@ def test_request_handler():
assert req.set_headers({default_key: default_val})
assert req.get_headers() == {default_key: default_val}
- assert not req.set_config(default_key, default_empty_str)
+ assert not req.set_config(default_empty_str, default_empty_str)
+ assert req.set_config(default_key, default_empty_str)
assert req.set_config(default_key, default_val)
assert req.get_config(default_key) == default_val