Skip to content

Commit 6d2de7e

Browse files
authored
fix: make the message clearer when API key is missing (#11370)
1 parent de1669d commit 6d2de7e

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

apisix/plugins/key-auth.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ function _M.rewrite(conf, ctx)
7777
end
7878

7979
if not key then
80-
return 401, {message = "Missing API key found in request"}
80+
return 401, {message = "Missing API key in request"}
8181
end
8282

8383
local consumer_conf = consumer_mod.plugin(plugin_name)

docs/en/latest/plugins/key-auth.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ curl http://127.0.0.2:9080/index.html -i
141141
```
142142
HTTP/1.1 401 Unauthorized
143143
...
144-
{"message":"Missing API key found in request"}
144+
{"message":"Missing API key in request"}
145145
```
146146

147147
```shell

docs/zh/latest/plugins/key-auth.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ curl http://127.0.0.2:9080/index.html -i
148148
```shell
149149
HTTP/1.1 401 Unauthorized
150150
...
151-
{"message":"Missing API key found in request"}
151+
{"message":"Missing API key in request"}
152152
```
153153

154154
```shell

t/plugin/cors.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ ExternalHeader1: val
454454
ExternalHeader2: val
455455
ExternalHeader3: val
456456
--- response_body
457-
{"message":"Missing API key found in request"}
457+
{"message":"Missing API key in request"}
458458
--- error_code: 401
459459
--- response_headers
460460
Access-Control-Allow-Origin: https://sub.domain.com

t/plugin/key-auth.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ apikey: 123
173173
GET /hello
174174
--- error_code: 401
175175
--- response_body
176-
{"message":"Missing API key found in request"}
176+
{"message":"Missing API key in request"}
177177
178178
179179

0 commit comments

Comments
 (0)