Answer the question
In order to leave comments, you need to log in
Why does the request not see the body?
There is a Delete controller that throws an error and does not want to delete the user by body.
@DeleteMapping("*/deleteoneusers")
public void deleteUsers(@RequestBody User user) {
userRepository.delete(user);
}
Answer the question
In order to leave comments, you need to log in
According to the standard, delete requests cannot have a body - RFC 7231 .
because you are sending an array and expecting one element.
and it is not yet clear which content-type is set.
Why the whole object at all, when id is enough for deletion?
@DeleteMapping("/users/{id}")
void deleteUser(@PathVariable Long id) {
repository.deleteById(id);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question