apache / apache/apisix-java-plugin-runner
request help: i want to rewrite the response and then return to the client
- Dominant language
- Java
- Stars
- 152
- Forks
- 102
- PR merge metrics
- No merged PRs in 30d
Description
### Issue description
I want to get the upstream response content in the plugin for processing and then return to the client, but it return null
This is how the class is handled:
@Override
public void postFilter(PostRequest request, PostResponse response, PluginFilterChain chain) {
log.warn("ClientAuthenticationFilter is running");
log.warn("status:{}", request.getUpstreamStatusCode());
// get the upstream response body
String responseBody = request.getBody();
ResultData resultData = JsonUtils.json2Bean(responseBody , ResultData.class);
ResultData authResult = new ResultData<>();
authResult.setCode(resultData.getCode());
authResult.setMessage(resultData.getMessage());
if(ObjectUtils.isNotEmpty(resultData.getData())){
AuthUserVo authUserVo = processAuthResult(resultData.getData());
authResult.setData(authUserVo);
}
response.setBody(JsonUtils.bean2Json(authResult));
chain.postFilter(request, response);
}
java.lang.NullPointerException: null
postFilter(ClientAuthenticationFilter.java:85)
### Environment
* your apisix-java-plugin-runner version 0.4.0
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.