This commit is contained in:
kicaj 2019-01-11 13:20:09 +01:00 committed by GitHub
parent 108313d74c
commit bcbe5fdcf0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -452,15 +452,13 @@ class HttpSocket extends CakeSocket {
* @return false|HttpSocketResponse Result of request, either false on failure or the response to the request. * @return false|HttpSocketResponse Result of request, either false on failure or the response to the request.
*/ */
public function get($uri = null, $query = array(), $request = array()) { public function get($uri = null, $query = array(), $request = array()) {
if (!empty($query)) { $uri = $this->_parseUri($uri, $this->config['request']['uri']);
$uri = $this->_parseUri($uri, $this->config['request']['uri']); if (isset($uri['query'])) {
if (isset($uri['query'])) { $uri['query'] = array_merge($uri['query'], $query);
$uri['query'] = array_merge($uri['query'], $query); } else {
} else { $uri['query'] = $query;
$uri['query'] = $query;
}
$uri = $this->_buildUri($uri);
} }
$uri = $this->_buildUri($uri);
$request = Hash::merge(array('method' => 'GET', 'uri' => $uri), $request); $request = Hash::merge(array('method' => 'GET', 'uri' => $uri), $request);
return $this->request($request); return $this->request($request);
@ -478,15 +476,13 @@ class HttpSocket extends CakeSocket {
* @return false|HttpSocketResponse Result of request, either false on failure or the response to the request. * @return false|HttpSocketResponse Result of request, either false on failure or the response to the request.
*/ */
public function head($uri = null, $query = array(), $request = array()) { public function head($uri = null, $query = array(), $request = array()) {
if (!empty($query)) { $uri = $this->_parseUri($uri, $this->config['request']['uri']);
$uri = $this->_parseUri($uri, $this->config['request']['uri']); if (isset($uri['query'])) {
if (isset($uri['query'])) { $uri['query'] = array_merge($uri['query'], $query);
$uri['query'] = array_merge($uri['query'], $query); } else {
} else { $uri['query'] = $query;
$uri['query'] = $query;
}
$uri = $this->_buildUri($uri);
} }
$uri = $this->_buildUri($uri);
$request = Hash::merge(array('method' => 'HEAD', 'uri' => $uri), $request); $request = Hash::merge(array('method' => 'HEAD', 'uri' => $uri), $request);
return $this->request($request); return $this->request($request);