I am creating a package to work with a rather difficult API, which also has as a rule, (not always) to return a 200 status to everything that is sent, including when there is an error, instead of using the correct HTTP Response code.
Instead send the response without data, and in the metadata change the status to 0, and the reason indicates the error (string)
In my opinion, the correct thing is that my package returns an appropriate HTTP response code to the error (easier to manage for those who use the package and closer to the reality of a Restful API) and leave the error management to the user's hand when you receive the json response with the code and your message.
But when I see it, I see that the response that Guzzle sends me does not contain setters to modify the status. So I have to create an HTTP response.
How can I generate that response, containing the status code? What would be the way?
I must be work with use Illuminate\Http\Response;?