apache / apache/apisix-java-plugin-runner
request help: i want to rewrite the response and then return to the client
- 主要語言
- Java
- 星號
- 152
- 分支
- 102
- PR 合併指標
- 30 天內沒有已合併 PR
描述
### 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
貢獻指南
這個儲存庫沒有索引到貢獻指南
評估
這個 Issue 還沒有評估資料。