[
https://issues.apache.org/jira/browse/CAMEL-23698?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen updated CAMEL-23698:
--------------------------------
Fix Version/s: 4.21.0
> camel-rest-openapi - Producer appends trailing ? to URL when no query
> parameters are set
> ----------------------------------------------------------------------------------------
>
> Key: CAMEL-23698
> URL: https://issues.apache.org/jira/browse/CAMEL-23698
> Project: Camel
> Issue Type: Bug
> Components: camel-rest-openapi
> Affects Versions: 4.18.2
> Reporter: Claus Ibsen
> Assignee: Saravanakumar Selvaraj
> Priority: Minor
> Fix For: 4.21.0
>
>
> When a REST call is created from an OpenAPI spec via camel-rest-openapi, the
> producer sends a URL ending with an empty query part (?) even though no query
> parameters are set.
> *Example:*
> - API: GitHub GET /users/\{username\}/repos (with optional type query
> parameter)
> - Route:
> from("direct:listRepos").to("rest-openapi:github-api.json#listUserRepos");
> - Actual URL invoked: /users/myuser/repos?
> - Expected URL: /users/myuser/repos
> This can be a problem for services that treat /resource and /resource?
> differently.
> *Root cause:* {{URISupport.createURIWithQuery()}} in camel-util appends ?
> whenever the query string is non-null, even when it is empty. The fix is to
> also check {{!query.isEmpty()}} at line 446.
> *Reported against:* 4.18.2
> *Reporter:* Saravanakumar Selvaraj
--
This message was sent by Atlassian Jira
(v8.20.10#820010)