This is an automated email from the ASF dual-hosted git repository.
navendu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git
The following commit(s) were added to refs/heads/master by this push:
new 6d2de7ee2 fix: make the message clearer when API key is missing
(#11370)
6d2de7ee2 is described below
commit 6d2de7ee2f41632af82daff3102c6254c7ccc4b6
Author: Navendu Pottekkat <[email protected]>
AuthorDate: Wed Jun 26 10:50:22 2024 +0530
fix: make the message clearer when API key is missing (#11370)
---
apisix/plugins/key-auth.lua | 2 +-
docs/en/latest/plugins/key-auth.md | 2 +-
docs/zh/latest/plugins/key-auth.md | 2 +-
t/plugin/cors.t | 2 +-
t/plugin/key-auth.t | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/apisix/plugins/key-auth.lua b/apisix/plugins/key-auth.lua
index f8cfddae0..7196a13e6 100644
--- a/apisix/plugins/key-auth.lua
+++ b/apisix/plugins/key-auth.lua
@@ -77,7 +77,7 @@ function _M.rewrite(conf, ctx)
end
if not key then
- return 401, {message = "Missing API key found in request"}
+ return 401, {message = "Missing API key in request"}
end
local consumer_conf = consumer_mod.plugin(plugin_name)
diff --git a/docs/en/latest/plugins/key-auth.md
b/docs/en/latest/plugins/key-auth.md
index 93705111d..985036640 100644
--- a/docs/en/latest/plugins/key-auth.md
+++ b/docs/en/latest/plugins/key-auth.md
@@ -141,7 +141,7 @@ curl http://127.0.0.2:9080/index.html -i
```
HTTP/1.1 401 Unauthorized
...
-{"message":"Missing API key found in request"}
+{"message":"Missing API key in request"}
```
```shell
diff --git a/docs/zh/latest/plugins/key-auth.md
b/docs/zh/latest/plugins/key-auth.md
index f45b514e3..13a08e7d9 100644
--- a/docs/zh/latest/plugins/key-auth.md
+++ b/docs/zh/latest/plugins/key-auth.md
@@ -148,7 +148,7 @@ curl http://127.0.0.2:9080/index.html -i
```shell
HTTP/1.1 401 Unauthorized
...
-{"message":"Missing API key found in request"}
+{"message":"Missing API key in request"}
```
```shell
diff --git a/t/plugin/cors.t b/t/plugin/cors.t
index 924a8b1fa..79e32513d 100644
--- a/t/plugin/cors.t
+++ b/t/plugin/cors.t
@@ -454,7 +454,7 @@ ExternalHeader1: val
ExternalHeader2: val
ExternalHeader3: val
--- response_body
-{"message":"Missing API key found in request"}
+{"message":"Missing API key in request"}
--- error_code: 401
--- response_headers
Access-Control-Allow-Origin: https://sub.domain.com
diff --git a/t/plugin/key-auth.t b/t/plugin/key-auth.t
index f68fe3088..5c28e6bad 100644
--- a/t/plugin/key-auth.t
+++ b/t/plugin/key-auth.t
@@ -173,7 +173,7 @@ apikey: 123
GET /hello
--- error_code: 401
--- response_body
-{"message":"Missing API key found in request"}
+{"message":"Missing API key in request"}