You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2018/07/13 01:57:37 UTC
[GitHub] WillemJiang commented on a change in pull request #800: [SCB-726]
edge support convert from form-data or x-www-form-urlencoded to json
automatically
WillemJiang commented on a change in pull request #800: [SCB-726] edge support convert from form-data or x-www-form-urlencoded to json automatically
URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/800#discussion_r202226241
##########
File path: common/common-rest/src/main/java/org/apache/servicecomb/common/rest/codec/param/BodyProcessorCreator.java
##########
@@ -70,8 +78,8 @@ public Object getValue(HttpServletRequest request) throws Exception {
if (isRequired == false && inputStream.available() == 0) {
return null;
}
- String contentType = request.getContentType();
- if (contentType != null && !contentType.toLowerCase(Locale.US).startsWith(MediaType.APPLICATION_JSON)) {
+
+ if (!contentType.isEmpty() && !contentType.startsWith(MediaType.APPLICATION_JSON)) {
// TODO: we should consider body encoding
return IOUtils.toString(inputStream, "UTF-8");
Review comment:
we may need to check the charset in the content-type for the encoding.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services