-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exception on url with redirects. #406
Comments
Probably something you can solve by setting some configuration to Guzzle right before the call (I think it's already the case on feed reading). Can you submit the pull request to solve this please ? |
Actually, because of PSR-18, the use of |
Can confirm, I'm running into the same issue, and while it theoretically could easily be solved, it opens up a few questions.
@alexdebril do you have any insights into usage wrt the third party client libraries? Any preference in which direction this could / should move? Edit: As a workaround, I've extended the protected function request(string $method, string $url, DateTime $modifiedSince = null): ResponseInterface
{
try {
return parent::request($method, $url, $modifiedSince);
} catch (ServerErrorException $e) {
$psrResponse = $e->getResponse();
if (in_array($psrResponse->getStatusCode(), [301, 302], true)) {
return parent::request($method, $psrResponse->getHeader("location")[0], $modifiedSince);
}
throw $e;
}
} This works for one level of redirect, which is most likely enough for most cases (redirecting to whatever URL you tried first, with a slash added or removed at the end). Personally, I can live with this, even though I do consider this a bit of a hacky solution... :) I could also PR it if you'd appreciate that. |
When I'm running Guzzle standalone requests, get status 200
When running with FeedIo, it's throws an exception
composer.json
The text was updated successfully, but these errors were encountered: