Request parameters, lead to an incorrecty generated cURL request
See original GitHub issueVersion: 2.9.2 (latest) Kind: Bug report
Hey, I think I’ve found a bug in the generation of the curl request, when clicking on ‘Try it out’.
I’ve got following endpoint:
@RequestMapping(method = RequestMethod.GET, path = "/ranking/country", produces = MediaType.APPLICATION_JSON_VALUE)
@ApiOperation(value = "Returns a ranking of the top countries with the most sensors")
public List<RankingItemCountry> getRankingByCountry(
@RequestParam(defaultValue = "10") int items
) throws RankingDataException {
if(items < 1) throw new RankingDataException(ErrorCodeUtils.INVALID_ITEMS_NUMBER);
return sensorRepository.getRankingByCountry(items);
}
On the UI page it looks like this:
Look at the generated curl request. It is wrong isn’t it?
The expected request should look like this:
https://<api-url>.com/ranking/city?items=2
This results in a 404 response code. I would appreciate, if it can be fixed. Thanks for your awesome implementation!
Marc
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (5 by maintainers)
Top Results From Across the Web
CURL Command Line URL Parameters - Stack Overflow
I tried using some GUI application and when I pass the url as: http://localhost:5000/locations?id=3 , it works. I really would rather use CURL...
Read more >Solved: Adding request params through curl is throwing jav...
I tried the same curl command generated by the REST Explorer. I'd noticed that If I haven't add query parameters ( --data )...
Read more >Copy as curl
Paste that in a shell to get a curl command line that makes the transfer. This feature is available by default in all...
Read more >HTTP Requests and Responses
Can be caused by an incorrect curl command, for example including a path parameter that isn't allowed, like using orgs/org_id for an endpoint...
Read more >curl_exec - Manual - PHP
$params['host']; ?> CURL automatically creates the host parameter (since it is required for HTTP/1.1 requests), so you don't need to set it. But...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
If you have two
@RequestMappings
with same url but different@RequestParam
, with enabledurlTempkating
SpringFox will generate two endpoints. Otherwise only one,the second mapping will be lost. But unfortunately, Swagger-UI doesn’t support that feature. So, it won’t be able to generate correct curl request.More about feature https://tools.ietf.org/html/rfc6570
add
@ApiImplicitParam
may solve your problem, like this: