saloon
saloon copied to clipboard
can't select response class with depend of response data
https://docs.saloon.dev/the-basics/responses#custom-responses When you need a more advanced way to define a custom response, use the resolveResponseClass method on either the connector or request.
But i can't select response class with depend of response data, like in https://docs.saloon.dev/the-basics/handling-failures#customising-when-saloon-thinks-a-request-has-failed
Π’Π°ΠΊ ΠΊΠ°ΠΊ ΡΡΠΎΡ ΠΌΠ΅ΡΠΎΠ΄ Π½Π΅ ΠΈΠΌΠ΅Π΅Ρ Π΄ΠΎΡΡΡΠΏΠ° ΠΊ response
public function getResponseClass(): string
{
$response = $this->request->resolveResponseClass() ?? $this->connector->resolveResponseClass() ?? Response::class;
if (! class_exists($response) || ! Helpers::isSubclassOf($response, Response::class)) {
throw new InvalidResponseClassException;
}
return $response;
}