At least one 200, 201, 202, or 204 response should be defined for DELETE operations

Description

DELETE operations in your API must have at least one 200, 201, 202, or 204 response defined.

For more details, see RFC 7231.

Example

The following is an example of how this type of risk could look in your API definition:

1delete:
2  description: Deletes a pet based on the ID
3  # ...
4  responses:
5    default:
6      description: Unexpected error
7      schema:
8        $ref: "#/components/schemas/Error"
9

Remediation

Define 200, 201, 202, or 204 responses for all DELETE operations.

1delete:
2  description: Deletes a pet based on the ID
3  # ...
4  responses:
5    "204":
6      description: Pet deleted
7    default:
8      description: Unexpected error
9      schema:
10        $ref: "#/components/schemas/Error"
11

Copyright 42Crunch 2021