Adding hasRequestFailed() method to connector always throws an exception
I am currently integrating with an external API that returns a 200 OK status for every request, even when the request has actually failed. To handle this, I added a hasRequestFailed method to the connector.
However, I've noticed that if the logic inside hasRequestFailed evaluates to true, an exception is immediately thrown when the request is sent. As a result, the code never reaches the point where it checks whether the request has failed — the error is raised at the point of sending the request itself.
I believe you just need to flip around the logic from true to false, if the hasRequestFailed returns true, then Saloon thinks the request has failed.
We added a temporary fix for issue by extending the shouldThrowRequestException() method and making it return false in both the connector and requests.