Skip to content
This repository was archived by the owner on Jan 30, 2020. It is now read-only.

Commit e5edad9

Browse files
committed
Merge branch 'hotfix/148-remove-method-repitition' into develop
Forward port #148
2 parents ad7684c + f44c9b2 commit e5edad9

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

src/Client/Adapter/Proxy.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,8 @@ public function write($method, $uri, $httpVer = '1.1', $headers = [], $body = ''
156156
// Build request headers
157157
if ($this->negotiated) {
158158
$path = $uri->getPath();
159-
if ($uri->getQuery()) {
160-
$path .= '?' . $uri->getQuery();
161-
}
159+
$query = $uri->getQuery();
160+
$path .= $query ? '?' . $query : '';
162161
$request = sprintf('%s %s HTTP/%s%s', $method, $path, $httpVer, "\r\n");
163162
} else {
164163
$request = sprintf('%s %s HTTP/%s%s', $method, $uri, $httpVer, "\r\n");

src/Client/Adapter/Socket.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -376,9 +376,8 @@ public function write($method, $uri, $httpVer = '1.1', $headers = [], $body = ''
376376

377377
// Build request headers
378378
$path = $uri->getPath();
379-
if ($uri->getQuery()) {
380-
$path .= '?' . $uri->getQuery();
381-
}
379+
$query = $uri->getQuery();
380+
$path .= $query ? '?' . $query : '';
382381
$request = $method . ' ' . $path . ' HTTP/' . $httpVer . "\r\n";
383382
foreach ($headers as $k => $v) {
384383
if (is_string($k)) {

src/Client/Adapter/Test.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,8 @@ public function write($method, $uri, $httpVer = '1.1', $headers = [], $body = ''
127127
if (empty($path)) {
128128
$path = '/';
129129
}
130-
if ($uri->getQuery()) {
131-
$path .= '?' . $uri->getQuery();
132-
}
130+
$query = $uri->getQuery();
131+
$path .= $query ? '?' . $query : '';
133132
$request = $method . ' ' . $path . ' HTTP/' . $httpVer . "\r\n";
134133
foreach ($headers as $k => $v) {
135134
if (is_string($k)) {

0 commit comments

Comments
 (0)