Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id C5285200C8C for ; Tue, 6 Jun 2017 15:16:41 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id C3CC3160BC6; Tue, 6 Jun 2017 13:16:41 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 160C0160BC3 for ; Tue, 6 Jun 2017 15:16:40 +0200 (CEST) Received: (qmail 14124 invoked by uid 500); 6 Jun 2017 13:16:40 -0000 Mailing-List: contact dev-help@brooklyn.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@brooklyn.apache.org Delivered-To: mailing list dev@brooklyn.apache.org Received: (qmail 14113 invoked by uid 99); 6 Jun 2017 13:16:40 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 Jun 2017 13:16:40 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id EB9D8DFAF1; Tue, 6 Jun 2017 13:16:39 +0000 (UTC) From: andreaturli To: dev@brooklyn.apache.org Reply-To: dev@brooklyn.apache.org References: In-Reply-To: Subject: [GitHub] brooklyn-server pull request #715: Feature/http commnand effector improvemen... Content-Type: text/plain Message-Id: <20170606131639.EB9D8DFAF1@git1-us-west.apache.org> Date: Tue, 6 Jun 2017 13:16:39 +0000 (UTC) archived-at: Tue, 06 Jun 2017 13:16:42 -0000 Github user andreaturli commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/715#discussion_r120356395 --- 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", "")) + .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 -- good idea, added it to the test --- 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. ---