S
S
Sergey2021-11-15 12:22:31
API
Sergey, 2021-11-15 12:22:31

What is the correct API behavior for an empty request body by default?

Colleagues, tell me how the public API should behave if the requirements indicate that it accepts an empty request body, and a request with data is sent to it.
Interested in options "according to the textbook" and in fact.
Should the API ignore the data, or should it respond with an error?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vasily Bannikov, 2021-11-15
@Jeisooo

If, according to the specification, the request should be without a body, but the client sends something in the body, then it is worth throwing 400 Bad Request

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question