brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andreaturli <...@git.apache.org>
Subject [GitHub] brooklyn-server pull request #715: Feature/http commnand effector improvemen...
Date Sun, 04 Jun 2017 19:37:04 GMT
Github user andreaturli commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/715#discussion_r120018659
  
    --- Diff: core/src/main/java/org/apache/brooklyn/core/effector/http/HttpCommandEffector.java
---
    @@ -181,7 +204,19 @@ private HttpRequest buildHttpRequest(String httpVerb, URI uri, Map<String,
Strin
                     if (contentType == null || contentType.equalsIgnoreCase(APPLICATION_JSON))
{
                         LOG.warn("Content-Type not specified. Using {}, as default (continuing)",
APPLICATION_JSON);
                         body = toJsonString(payload);
    -                } else if (!contentType.equalsIgnoreCase(APPLICATION_JSON)) {
    +                } else if (contentType.equalsIgnoreCase(APPLICATION_X_WWW_FORM_URLENCODE))
{
    +                    if (payload instanceof Map) {
    +                        for (Map.Entry<String, String> entry : ((Map<String,
String>) payload).entrySet()) {
    +                            try {
    +                                if (!body.equals("")) body += "&";
    +                                body += URLEncoder.encode(entry.getKey(), StandardCharsets.UTF_8.toString())
+ "=" + URLEncoder.encode(entry.getValue(), StandardCharsets.UTF_8.toString());
    --- End diff --
    
    Thanks @geomacy for helping me here. To be honest I don't know exactly what to do, probably
best to implement the less surprising behavior. I'll try to clarify with more tests and docs


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message