pavlenkodev commented on issue #10367:
URL: https://github.com/apache/apisix/issues/10367#issuecomment-1773743570

   > The plugin should be working. Here's my test:
   > 
   > ```shell
   > curl "http://127.0.0.1:9180/apisix/admin/routes/1"; -X PUT -d '
   > {
   >     "uri": "/get",
   >     "plugins": {
   >         "request-validation": {
   >             "header_schema": {
   >                 "type": "object",
   >                 "required": ["Host"],
   >                 "properties": {
   >                     "Host": {
   >                         "type": "string",
   >                         "enum": ["httpbin"]
   >                     }
   >                 }
   >             },
   >             "rejected_code": 555,
   >             "rejected_msg": "Oh No 555 reject message! \n"
   >         }
   >     },
   >     "upstream": {
   >         "type": "roundrobin",
   >         "nodes": {
   >             "httpbin.org:80": 1
   >         }
   >     }
   > }'
   > ```
   > 
   > 
![image](https://user-images.githubusercontent.com/39619599/277079976-1dcef43d-f42a-4aad-a5f6-effaa19e3128.png)
   
   
   
   I tried your example and it also worked. I assume that in conjunction with 
header_body rejected_msg works. I tried an example from the official 
documentation that used body_schema and rejected code and message don't work. 
https://apisix.apache.org/docs/apisix/plugins/request-validation/
   
   
   {
     "uri": "/get",
     "plugins": {
       "request-validation": {
         "body_schema": {
           "type": "object",
           "required": ["required_payload"],
           "properties": {
             "required_payload": {"type": "string"},
             "boolean_payload": {"type": "boolean"}
           },
           "rejected_msg": "customize reject message"
         }
       }
     },
     "upstream": {
       "type": "roundrobin",
       "nodes": {
         "127.0.0.1:8080": 1
       }
     }
   }
   
   Have you tried the same thing? Did you manage to output rejected message or 
code?
   
   
   


-- 
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]

Reply via email to