apache / apache/apisix-java-plugin-runner
request help: i want to rewrite the response and then return to the client
- Ngôn ngữ chính
- Java
- Star
- 152
- Fork
- 102
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
### 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
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Đánh giá
Issue này chưa được đánh giá.