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

TryIt doesn't send request body for DELETE requests #2230

Open
iamhosseindhv opened this issue Sep 5, 2022 · 3 comments
Open

TryIt doesn't send request body for DELETE requests #2230

iamhosseindhv opened this issue Sep 5, 2022 · 3 comments
Labels

Comments

@iamhosseindhv
Copy link

iamhosseindhv commented Sep 5, 2022

Context

When making an api request with method DELETE which has some body, the body is not sent. This seems to be intentional as per these lines:

const shouldIncludeBody = ['PUT', 'POST', 'PATCH'].includes(httpOperation.method.toUpperCase());

Current Behavior

As explained above

Expected Behavior

Request body should be sent for DELETE requests. It's worth noting that DELETE requests with request body is NOT against the specs. There might be many legacy apis that developers are documenting, which may have a DELEET endpoint with request body. Open Api Spec also supports DELETE requests with body. https://spec.openapis.org/oas/v3.1.0#version-3-1-0

Screenshot 2022-09-05 at 15 22 20

Related issues on OAS: OAI/OpenAPI-Specification#1801, OAI/OpenAPI-Specification#2117

Steps to Reproduce

  1. Use try-it widget to make a DELETE request with request body. Note how in the screenshot below, it is documented that the endpoint accepts some body, but "Request Sample" does not reflect the same

Screenshot 2022-09-05 at 15 23 51

Environment

  • Version used:
  • Environment name and version (e.g. Chrome 39, node.js 5.4):
  • Operating System and version (desktop or mobile):
  • Link to your environment/workspace/project:
@mnaumanali94 mnaumanali94 added the enhancement New feature or request label Sep 8, 2022
@mnaumanali94
Copy link
Contributor

We can potentially create a rule in Spectral to warn users but support it in the docs.

@philsturgeon
Copy link
Contributor

@mnaumanali94 I agree, thats a good way to split it. When there is a SHOULD that means people could. Spectral can help make things better, and Elements should show whatever it understands regardless of opinion. IMO. :D

@falsaffa falsaffa added this to the Q3 '23 milestone Jul 12, 2023
@falsaffa falsaffa removed this from the Q3 '23 milestone Jul 31, 2023
@Invincibear
Copy link

Any updates on this?

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

No branches or pull requests

6 participants