leslie-tsang commented on a change in pull request #5122:
URL: https://github.com/apache/apisix/pull/5122#discussion_r716348172
##########
File path: t/plugin/request-validation.t
##########
@@ -1445,7 +1406,255 @@ qr/table expected, got string/
GET /t
--- response_body
passed
+--- no_error_log
+[error]
+
+
+
+=== TEST 35: add route (test request validation `header_schema.required`
success with custom reject message)
+--- 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": {
+ "request-validation": {
+ "header_schema": {
+ "type": "object",
+ "properties": {
+ "test": {
+ "type": "string",
+ "enum": ["a", "b", "c"]
+ }
+ },
+ "required": ["test"]
+ },
+ "rejected_msg": "customize reject message for
header_schema.required"
+ }
+ },
+ "upstream": {
+ "nodes": {
+ "127.0.0.1:1982": 1
+ },
+ "type": "roundrobin"
+ },
+ "uri": "/opentracing"
+ }]])
+ if code >= 300 then
+ ngx.status = code
+ end
+ ngx.say(body)
+ }
+ }
+--- request
+GET /t
+--- response_body
+passed
+--- no_error_log
+[error]
+
+
+
+=== TEST 36: hit TEST 35 rule with empty header
Review comment:
Make sense. I will fix it.
--
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]