Github user geomacy commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/715#discussion_r120019119
  
    --- 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 --
    
    ah I take it back - of course it's not the URL you're processing here, 
you're doing a POST on a form body; so in this case URLEncoder is what you want!


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to