bug:在PluginFilter类中通过requiredRespBody()方法设置为true后,在插件中调用PostRequest.getUpstreamStatusCode()方法会偶现(概率很高)获取到不正确的响应码
Issue description
在PluginFilter类中通过requiredRespBody()方法设置为true后,在插件中调用PostRequest.getUpstreamStatusCode()方法会偶现(概率很高)获取到不正确的响应码
Environment
- apisix-java-plugin-runner 0.4.0
- apisix 3.2.0
- apisix-dashboard 3.0.0
Minimal test code / Steps to reproduce the issue
1.通过apisix-dashboard创建路由使用ext-plugin-post-resp插件
2.写一个简单的java测试插件,并且设置requiredRespBody()和requiredBody()都为true
3.查看日志发现一会是正常的406,一会是57

What's the actual result? (including assertion message & call stack if applicable)
What's the expected result?
这个和下面这个问题应该是一类问题 https://github.com/apache/apisix-java-plugin-runner/issues/234
修正一下PostRequest的构造函数就行可以了: public PostRequest(Req req) { this.req = req; this.status = req.status(); headers = new HashMap<>(); for (int i = 0; i < req.headersLength(); i++) { TextEntry header = req.headers(i); headers.put(header.name(), header.value()); } }
@frankqoqo8 好的,感谢,我找时间验证一下
It worked ! a non-official workaround https://github.com/gaoxingliang/apisix-java-plugin-runner/commit/6d1ccd30ab44f6faf5825d7891433be9f97b2ee7