Closed teanooki closed 11 months ago
Hello,
Thank you for helping in improving this library!
I agree that the behaviour you mentioned is erroneous. The thing is that the endpoint you are referring to is the only one which returns not 200 in case of success and I just missed that :)
However, speaking of 3xx responses, despite they are valid from HTTP protocol point of view, they are still exceptional from the point of view of the library, as there is no scenario how the library has to react to such a response.
So I'd say as a temporary solution it's better to include 202 response code in the list, because any other response code will probably need additional program code as a reaction to them.
As a full-fledged solution I see some refactoring with introducing HttpRequest/HttpResponse classes which are passed to Response class so that the implementation of specific response can react to the HTTP response code.
Thank you. :+1: Regarding the HttpRequest/HttpResponse: implementing the PSR interfaces would be awesome. But in this case it would be too much overhead and accepting the 202 status is just fine.
Status codes below 300 are valid. And status codes in the 300s are redirections or similar tasks for the client side. So, a exception for all status codes not equal to 200 is wrong.
The main problem here is that the "Send Consumtion Information" endpoint returns a 202 under normal circumstances:
https://developer.apple.com/documentation/appstoreserverapi/send_consumption_information#response-codes