Skip to content
New issue

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

Unnecessary -d '' in CURL when no request body #9785

Open
vbulash opened this issue Apr 6, 2024 · 0 comments
Open

Unnecessary -d '' in CURL when no request body #9785

vbulash opened this issue Apr 6, 2024 · 0 comments

Comments

@vbulash
Copy link

vbulash commented Apr 6, 2024

My OpenApi 3.0 yml opened on HTML page with swagger-ui-dist 5.11.0.
In one endpoint where request body absent, Execute run request and produces the following output:

curl -X 'POST' \
  'http://localhost:84/query?org=influx&pretty=true&db=influx&q=select%20%2A%20from%20connection' \
  -H 'accept: application/json' \
  -H 'Authorization: Token my_token' \
  -d ''

Execute ends with errors.
The only valid form here without -d:

curl -X 'POST' \
  'http://localhost:84/query?org=influx&pretty=true&db=influx&q=select%20%2A%20from%20connection' \
  -H 'accept: application/json' \
  -H 'Authorization: Token my_token'

Here in sources I found that swagger-api adds -d '' for POST requests with no request body.
Seems has no sense.
99.9% servers just ignore such case (empty but present data in CURL when no request body). But I faced with 0.01% where it has sense.
Is it possible to drop -d '' at all when no request body in POST-request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant