Catch TransferExceptions for HTTPClient::finalUrl() in case the headers are empty
This commit is contained in:
@@ -220,7 +220,7 @@ class HTTPClient implements IHTTPClient
|
||||
$urlResult = $this->resolver->resolveURL($url);
|
||||
|
||||
if ($urlResult->didErrorOccur()) {
|
||||
throw new TransferException($urlResult->getErrorMessageString());
|
||||
throw new TransferException($urlResult->getErrorMessageString(), $urlResult->getHTTPStatusCode());
|
||||
}
|
||||
|
||||
return $urlResult->getURL();
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
|
||||
namespace Friendica\Network;
|
||||
|
||||
use GuzzleHttp\Exception\TransferException;
|
||||
|
||||
/**
|
||||
* Interface for calling HTTP requests and returning their responses
|
||||
*/
|
||||
@@ -124,7 +126,8 @@ interface IHTTPClient
|
||||
* @param string $url A user-submitted URL
|
||||
*
|
||||
* @return string A canonical URL
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*
|
||||
* @throws TransferException In case there's an error during the resolving
|
||||
*/
|
||||
public function finalUrl(string $url);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user