I am currently contributing to a REST API written in Go and I was facing an existential question.
How are we supposed to handle an empty body in a PATCH? Knowing that a PATCH is used to update an existing data, are we supposed to return an error code (4XX) or an ok status (2XX)?
For example, if I have the following route: /user/:id
And a user has the following structure:
type User struct { Name string Email string}
So if we PATCH a specific user, we will either have a body containing the name or the email.
What should we do if it is empty?
The RFC5789 was not a real help (2.2 for error handling)