Claus Ibsen created CAMEL-23698:
-----------------------------------
Summary: 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
Reporter: Claus Ibsen
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)