return $this->locationInterface->delete('Country', $country->id) ? response(status: 204) : response(status: 500);
When I test the api for above delete method in postman, I get the parse error 'Parse Error: The server returned a malformed response'. In Laravel 10, I don't get any issue when I return status cod 204. Is this Laravel 11 issue or what?
If the model is deleted, return the 204 No Content response.
Don’t manually throw 500 errors like that. 500 errors are typically thrown when an exception happens. If you manually return a 500 response like that, you’re going to end up receiving useless errors where a customer reports something’s gone wrong, and you have nothing in your logs.