You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by GitBox <gi...@apache.org> on 2020/12/01 08:14:58 UTC

[GitHub] [incubator-dolphinscheduler] hunnuxiaobo commented on issue #2597: [BUG] bug title API post requests do not support json format

hunnuxiaobo commented on issue #2597:
URL: https://github.com/apache/incubator-dolphinscheduler/issues/2597#issuecomment-736301700


   I recently came across the same issue in my application, the source code shows that only supports simple json format(json with flat structure).
   
   file: DolphinScheduler\dolphinscheduler-server\src\main\java\org\apache\dolphinscheduler\server\task\http\HttTask.java
   line: 256
   code:
   
   `    protected void addRequestParams(RequestBuilder builder,List<HttpProperty> httpPropertyList) {
           if(CollectionUtils.isNotEmpty(httpPropertyList)){
               JSONObject jsonParam = new JSONObject();
               for (HttpProperty property: httpPropertyList){
                   if(property.getHttpParametersType() != null){
                       if (property.getHttpParametersType().equals(HttpParametersType.PARAMETER)){
                           builder.addParameter(property.getProp(), property.getValue());
                       }else if(property.getHttpParametersType().equals(HttpParametersType.BODY)){
                           jsonParam.put(property.getProp(), property.getValue());
                       }
                   }
               }
               StringEntity postingString = new StringEntity(jsonParam.toString(), Charsets.UTF_8);
               postingString.setContentEncoding(StandardCharsets.UTF_8.name());
               postingString.setContentType(APPLICATION_JSON);
               builder.setEntity(postingString);
           }
       }`
   
   it means you can't post deeply nested json format like {"key1": {"key2": "value"}}


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org