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

    https://github.com/apache/brooklyn-server/pull/715#discussion_r120349310
  
    --- Diff: 
core/src/test/java/org/apache/brooklyn/core/effector/http/HttpCommandEffectorTest.java
 ---
    @@ -248,6 +248,27 @@ public void testPayloadWithContentTypeHeaderXml() 
throws InterruptedException {
        }
     
        @Test
    +   public void testPayloadWithContentTypeFormUrlEncoded() throws 
InterruptedException {
    +      server.enqueue(jsonResponse("url-encoded-response.json"));
    +
    +      httpCommandEffector = new HttpCommandEffector(ConfigBag.newInstance()
    +              .configure(HttpCommandEffector.EFFECTOR_NAME, 
EFFECTOR_HTTP_COMMAND.getName())
    +              .configure(HttpCommandEffector.EFFECTOR_URI, url("/post"))
    +              .configure(HttpCommandEffector.EFFECTOR_HTTP_VERB, "POST")
    +              .configure(HttpCommandEffector.EFFECTOR_HTTP_PAYLOAD, 
ImmutableMap.of("key", "<img>"))
    +              .configure(HttpCommandEffector.EFFECTOR_HTTP_HEADERS, 
ImmutableMap.of(HttpHeaders.CONTENT_TYPE, 
HttpCommandEffector.APPLICATION_X_WWW_FORM_URLENCODE))
    +              .configure(HttpCommandEffector.JSON_PATH, "$.data")
    +      );
    +      assertNotNull(httpCommandEffector);
    +      TestEntity testEntity = 
app.createAndManageChild(buildEntitySpec(httpCommandEffector));
    +      Object output = testEntity.invoke(EFFECTOR_HTTP_COMMAND, 
ImmutableMap.of()).getUnchecked(Duration.seconds(1));
    +      assertEquals(output, "{\"key\", \"%3Cimg%3E\"}");
    +      
    +      assertEquals(server.getRequestCount(), 1);
    +      assertSent(server, "POST", "/post");
    --- End diff --
    
    you could add a check on the result of `assertSent` in here to verify that 
the payload key got successfully URL encoded


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to