[
https://issues.apache.org/jira/browse/CAMEL-12594?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16536664#comment-16536664
]
ASF GitHub Bot commented on CAMEL-12594:
----------------------------------------
davsclaus closed pull request #2409: CAMEL-12594 repro
URL: https://github.com/apache/camel/pull/2409
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git
a/camel-core/src/test/java/org/apache/camel/component/rest/RestProducerTest.java
b/camel-core/src/test/java/org/apache/camel/component/rest/RestProducerTest.java
index 0145e2bfa89..50ce9428467 100644
---
a/camel-core/src/test/java/org/apache/camel/component/rest/RestProducerTest.java
+++
b/camel-core/src/test/java/org/apache/camel/component/rest/RestProducerTest.java
@@ -40,17 +40,17 @@ public void shouldCreateDefinedQueryParameters() throws
UnsupportedEncodingExcep
public void
shouldCreateOptionalPlaceholderQueryParametersForPresentValues()
throws UnsupportedEncodingException, URISyntaxException {
final DefaultMessage message = new DefaultMessage(camelContext);
- message.setHeader("param", "header");
+ message.setHeader("paramPlaceholderName", "paramValue");
- assertEquals("param=header",
RestProducer.createQueryParameters("param={param?}", message));
+ assertEquals("param=paramValue",
RestProducer.createQueryParameters("param={paramPlaceholderName?}", message));
}
@Test
public void shouldCreatePlaceholderQueryParameters() throws
UnsupportedEncodingException, URISyntaxException {
final DefaultMessage message = new DefaultMessage(camelContext);
- message.setHeader("param", "header");
+ message.setHeader("paramPlaceholderName", "paramValue");
- assertEquals("param=header",
RestProducer.createQueryParameters("param={param}", message));
+ assertEquals("param=paramValue",
RestProducer.createQueryParameters("param={paramPlaceholderName}", message));
}
@Test
@@ -63,17 +63,17 @@ public void
shouldNotCreateOptionalPlaceholderQueryParametersForMissingValues()
throws UnsupportedEncodingException, URISyntaxException {
final DefaultMessage message = new DefaultMessage(camelContext);
- assertEquals("", RestProducer.createQueryParameters("param={param?}",
message));
+ assertEquals("",
RestProducer.createQueryParameters("param={paramPlaceholderName?}", message));
}
@Test
public void shouldSupportAllCombinations() throws
UnsupportedEncodingException, URISyntaxException {
final DefaultMessage message = new DefaultMessage(camelContext);
- message.setHeader("required", "header_required");
- message.setHeader("optional_present", "header_optional_present");
+ message.setHeader("requiredParamPlaceholder", "header_required_value");
+ message.setHeader("optionalPresentParamPlaceholder",
"header_optional_present_value");
-
assertEquals("given=value&required=header_required&optional_present=header_optional_present",
+
assertEquals("given=value&required=header_required_value&optional_present=header_optional_present_value",
RestProducer.createQueryParameters(
-
"given=value&required={required}&optional={optional?}&optional_present={optional_present?}",
message));
+
"given=value&required={requiredParamPlaceholder}&optional={optionalParamPlaceholder?}&optional_present={optionalPresentParamPlaceholder?}",
message));
}
}
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> Rest Producer - Query Parameters : Wrong query parameter name is used when
> header substitution is performed
> ------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-12594
> URL: https://issues.apache.org/jira/browse/CAMEL-12594
> Project: Camel
> Issue Type: Bug
> Components: camel-core
> Affects Versions: 2.22.0
> Reporter: Leonid Remennik
> Assignee: Claus Ibsen
> Priority: Major
> Labels: rest
> Fix For: 2.21.2, 2.22.1, 2.23.0
>
>
> CAMEL-11050
> [https://github.com/apache/camel/commit/35638b280be7ca43031ea4c5d937590f30495e70]
> Introduced a bug in this line
> [https://github.com/apache/camel/blob/6938a4ea6b68e295fae48f52e8e7cb2628f161a3/camel-core/src/main/java/org/apache/camel/component/rest/RestProducer.java#L409]
>
> The fix is (probably) to replace the line with :
> params.put(entry.getKey(), value);
>
>
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)