Open dotasek opened 6 years ago
Thanks for the report, but it would really help having an API definition that reproduces the problem.
Here is a definition reproducing the issue: petstore.swagger.io/?...url=http://heldersepu.github.io/hs-scripts/swagger/4263_swagger.yaml
I thing the Possible solution will be on:
https://github.com/swagger-api/swagger-ui/blob/master/src/core/curlify.js#L9
But is replacing spaces with %20
all we need? or are there other problematic characters?
Thank you Helder, that's the situation I was describing.
I was looking at other chars that could be causing problems the #
is a problem too...
http://swagger-net-test.azurewebsites.net/swagger/ui/index?filter=ArrayTest#/ArrayTest/ArrayTest_Put
And that one is causing bigger problems in the UI
@dotasek can you please clarify
Replacing the spaces with %20 fixes the issue:
what's %20
mean ?
curl expects that the URL is properly URL-encoded. The https://tools.ietf.org/html/rfc3986#section-2 explains what has to be encoded. @vikramvi "%20" is simply an ASCII code for space written in hexadecimal.
Expected Behavior
The generated curl available in the UI should be immediately executable when it's copied to a terminal, even if the address contains spaces.
Current Behavior
On operations that contain spaces, the generated curl cannot be executed within a linux console.
For example, this operation:
POST /v1/commands/apps/list disabled
results in a 400 error if you try to execute the resulting curl:Possible Solution
Replacing the spaces with
%20
fixes the issue:Context
We are representing some underlying API that unfortunately allows spaces in its naming convention. Developers attempting to quickly script REST communications were held up.