Skip to content

Commit

Permalink
Update CurlRequest.php
Browse files Browse the repository at this point in the history
  • Loading branch information
evasyakin committed Aug 29, 2021
1 parent 3aca224 commit 637386d
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/CurlRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,9 @@ public function prepareSend(): CurlRequest
$ch = $this->getCh();
$method = $this->getMethod();
$uri = $this->getUri();

// добавляем данные запроса
if ('GET' === $method) {
$body = $this->getQuery();
$uri .= static::prepareDataToUriQuery($body);
} else {
if ('GET' !== $method) {
$type = $this->getHeader('Content-Type');
if (false !== strpos($type, 'application/json')) {
$this->withBodyJson($this->getBody());
Expand All @@ -80,7 +77,9 @@ public function prepareSend(): CurlRequest
$this->withHeader('Cookie', implode(';', $cookies));
}
$headers = $this->getHeadersLines();

// устанавливаем url и заголовки
$uri .= static::prepareDataToUriQuery($this->getQuery());
curl_setopt($ch, CURLOPT_URL, $uri);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
Expand Down

0 comments on commit 637386d

Please sign in to comment.