Let’s make a valid request. The following request conforms to the policy that we just created:
    
    
         curl -i -X POST "$KONNECT_PROXY_URL/anything" \
     -H "Content-Type: application/json" \
     --json '{
       "name": "Jason",
       "age": 20,
       "gender": "male",
       "parents": [
         "Joseph",
         "Viva"
       ]
     }'
 
 
 
    
    
         curl -i -X POST "http://localhost:8000/anything" \
     -H "Content-Type: application/json" \
     --json '{
       "name": "Jason",
       "age": 20,
       "gender": "male",
       "parents": [
         "Joseph",
         "Viva"
       ]
     }'
 
 
 
You should get a 200 response, and the request gets proxied to the upstream service.
Now, try a request with a payload that doesn’t conform to the policy:
    
    
         curl -i -X POST "$KONNECT_PROXY_URL/anything" \
     -H "Content-Type: application/json" \
     --json '{
       "name": "Jason",
       "age": 20,
       "gender": "male",
       "parents": [
         "Antonio",
         "Viva"
       ]
     }'
 
 
 
    
    
         curl -i -X POST "http://localhost:8000/anything" \
     -H "Content-Type: application/json" \
     --json '{
       "name": "Jason",
       "age": 20,
       "gender": "male",
       "parents": [
         "Antonio",
         "Viva"
       ]
     }'
 
 
 
In this case, the string Antonio is longer than the maximum allowed string length of 6, so the request is blocked.
The plugin returns a 400 response and the message Incorrect request format.