Cheol-Soon-Choi commented on issue #255:
URL: 
https://github.com/apache/apisix-java-plugin-runner/issues/255#issuecomment-1637243514

   my Route info
   ```
   {
     "uri": "/bodybody*",
     "name": "test1234",
     "methods": [
       "GET",
       "POST"
     ],
     "plugins": {
       "ext-plugin-post-resp": {
         "_meta": {
           "disable": false
         },
         "allow_degradation": false,
         "conf": [
           {
             "name": "Test_Gateway",
             "value": 
"{\"rejected_body2\":\"failed\",\"rejected_code2\":\"403\"}"
           }
         ]
       }
     },
     "upstream": {
       "nodes": [
         {
           "host": "127.0.0.1",
           "port": 8080,
           "weight": 1
         }
       ],
       "timeout": {
         "connect": 6,
         "send": 6,
         "read": 6
       },
       "type": "roundrobin",
       "scheme": "http",
       "pass_host": "pass",
       "keepalive_pool": {
         "idle_timeout": 60,
         "requests": 1000,
         "size": 320
       }
     },
     "status": 1
   }
   ```
   
   my filter info
   ```
       @Override
       public void filter(HttpRequest request, HttpResponse response, 
PluginFilterChain chain) {
           // get conf of current filter
           String configStr = request.getConfig(this);
           Gson gson = new Gson();
           Map<String, Object> conf = new HashMap<>();
           // convert according to the actual configured conf type
           conf = gson.fromJson(configStr, conf.getClass());
           String k1 = request.getVars("uri");
           String endP = k1.split("/")[1];
           log.info("nginx_uri: " + k1);
           log.info("is_args: " + request.getVars("is_args"));
           chain.filter(request, response);
       }
   
       @Override
       public void postFilter(PostRequest request, PostResponse response, 
PluginFilterChain chain) {
           log.info("--------------------post filter 
start------------11111111");
   //        log.info(request.getUpstreamHeaders().toString());
           log.info(request.getUpstreamStatusCode().toString());
           log.info(request.getBody());
           log.info("--------------------post filter end------------11111111");
   
           chain.postFilter(request, response);
       }
   
       @Override
       public List<String> requiredVars() {
           List<String> vars = new ArrayList<>();
           return vars;
       }
   
       @Override
       public Boolean requiredBody() {
           return true;
       }
   
       @Override
       public Boolean requiredRespBody() {
           return true;
       }
   ```
   
   my upstream(127.0.0.1:8080) info
   ```
       @GetMapping("/bodybody*")
       public ResponseEntity fea2A2s2sbcd22d31222212d(@RequestHeader 
Map<String, String> headers) {
   
           for (Map.Entry<String, String> entry : headers.entrySet()) {
               System.out.println("key: " + entry.getKey() + ", value: " + 
entry.getValue());
           }
   
           HttpHeaders aaHeaders = new HttpHeaders();
           aaHeaders.add("test", "1234");
   
           if (headers.get("error") != null & 
headers.get("error").equals("400")) {
               return new ResponseEntity(aaHeaders, HttpStatus.BAD_REQUEST);
   
           } else if (headers.get("error") != null & 
headers.get("error").equals("500")) {
               return new ResponseEntity(aaHeaders, 
HttpStatus.INTERNAL_SERVER_ERROR);
           }
   
           return new ResponseEntity(aaHeaders, HttpStatus.OK);
       }
   ```
   
   u can repro with my info @nic-chen


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