We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
-d
The generated curl sample code doesn't escape single quote for JSON body.
This can be reproduced with the OpenAPI spec below:
{ "openapi": "3.0.0", "paths": { "/": { "post": { "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "text": { "type": "string" } } }, "examples": { "Message": { "value": { "text": "The user's message" } } } } } } } } } }
The corresponding curl syntax doesn't escape ' for -d:
'
curl -X POST "http://localhost:3000/" \ -H "content-type: application/json" \ -d '{"text":"The user's message"}'
The correct syntax is:
curl -X POST "http://localhost:3000/" \ -H "content-type: application/json" \ -d '{"text":"The user'\''s message"}'
Change this line to:
curlData = ` -d '${JSON.stringify(JSON.parse(exampleTextAreaEl.value.replace(/'/g, "'\\''")))}' \\\n`;
The text was updated successfully, but these errors were encountered:
thanks, will take a look soon
Sorry, something went wrong.
fixes #1068 curl syntax for JSON -d should escape single quote
17a1180
No branches or pull requests
Description
The generated curl sample code doesn't escape single quote for JSON body.
Reproduction
This can be reproduced with the OpenAPI spec below:
The corresponding curl syntax doesn't escape
'
for-d
:The correct syntax is:
Suggestion
Change this line to:
The text was updated successfully, but these errors were encountered: