Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,8 @@ | |
namespace Room11\Jeeves\Plugins; | ||
|
||
use Amp\Artax\HttpClient; | ||
use Amp\Artax\Response; | ||
use Amp\Artax\Request as HttpRequest; | ||
use Amp\Artax\Response as HttpResponse; | ||
use PeeHaa\AsyncTwitter\Api\Client\Client as TwitterClient; | ||
use PeeHaa\AsyncTwitter\Api\Client\ClientFactory as TwitterClientFactory; | ||
use PeeHaa\AsyncTwitter\Api\Client\Exception\RequestFailed as TwitterRequestFailedException; | ||
|
@@ -128,8 +129,14 @@ private function replaceImages(\DOMDocument $dom) | |
$target = 'https:' . $target; | ||
} | ||
|
||
/** @var Response $response */ | ||
$response = yield $this->httpClient->request($target); | ||
/** @var HttpResponse $response */ | ||
$request = (new HttpRequest) | ||
->setMethod('GET') | ||
->setUri($target) | ||
->setHeader('Connection', 'close'); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
PeeHaa
Member
|
||
|
||
/** @var HttpResponse $response */ | ||
$response = yield $this->httpClient->request($request); | ||
$tmpFilePath = \Room11\Jeeves\DATA_BASE_DIR . '/' . uniqid('twitter-media-', true); | ||
yield \Amp\File\put($tmpFilePath, $response->getBody()); | ||
|
||
|
why do we need this header especially for twitter? should we use it in more places in this codebase?