justlemontree opened a new issue, #3338:
URL: https://github.com/apache/incubator-shenyu/issues/3338
### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
a backend service response with the Content-Type of
application/json;charset=UTF-8, will cause the an error in
ModifyResponsePlugin, response with the Content-Type of application/json is
normal.
private byte[] modifyBody(final byte[] responseBody) {
try {
String bodyStr = modifyBody(new String(responseBody,
StandardCharsets.UTF_8));
LOG.info("the body string {}", bodyStr);
return bodyStr.getBytes(StandardCharsets.UTF_8);
} catch (Exception e) {
LOG.error("modify response error", e);
throw new ShenyuException(String.format("response modify
failure. %s", e.getLocalizedMessage()));
}
}
String bodyStr = modifyBody(new String(responseBody,
StandardCharsets.UTF_8)); 直接抛异常
### Expected Behavior
ModifyResponsePlugin support response with the Content-Type of
application/json;charset=UTF-8
### Steps To Reproduce
_No response_
### Environment
```markdown
ShenYu version(s):2.4.2
```
### Debug logs
2022-04-26 15:41:59 [reactor-http-nio-2] ERROR
org.apache.shenyu.plugin.modify.response.ModifyResponsePlugin - modify response
error
com.jayway.jsonpath.InvalidModificationException: Invalid put operation. $
is not a map
at
com.jayway.jsonpath.internal.PathRef$RootPathRef.put(PathRef.java:136)
at com.jayway.jsonpath.JsonPath.put(JsonPath.java:304)
at com.jayway.jsonpath.internal.JsonContext.put(JsonContext.java:221)
at com.jayway.jsonpath.internal.JsonContext.put(JsonContext.java:199)
at
org.apache.shenyu.plugin.modify.response.ModifyResponsePlugin$ModifyResponseDecorator.lambda$modifyBody$3
### Anything else?
please help me ,thank you
--
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]