mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-02-12 06:56:24 +00:00
omit equal sign if query component is not a key value pair
This commit is contained in:
parent
310a7a1acf
commit
cccf663c23
2 changed files with 22 additions and 1 deletions
|
@ -647,6 +647,7 @@ class HttpSocket extends CakeSocket {
|
||||||
|
|
||||||
$uri['path'] = preg_replace('/^\//', null, $uri['path']);
|
$uri['path'] = preg_replace('/^\//', null, $uri['path']);
|
||||||
$uri['query'] = $this->_httpSerialize($uri['query']);
|
$uri['query'] = $this->_httpSerialize($uri['query']);
|
||||||
|
$uri['query'] = rtrim($uri['query'], '=');
|
||||||
$stripIfEmpty = array(
|
$stripIfEmpty = array(
|
||||||
'query' => '?%query',
|
'query' => '?%query',
|
||||||
'fragment' => '#%fragment',
|
'fragment' => '#%fragment',
|
||||||
|
|
|
@ -568,6 +568,26 @@ class HttpSocketTest extends CakeTestCase {
|
||||||
$this->assertContains('Host: cakephp.org:8080', $this->Socket->request['header']);
|
$this->assertContains('Host: cakephp.org:8080', $this->Socket->request['header']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test urls like http://cakephp.org/index.php?somestring without key/value pair for query
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testRequestWithStringQuery() {
|
||||||
|
$this->Socket->reset();
|
||||||
|
$request = array(
|
||||||
|
'uri' => array(
|
||||||
|
'scheme' => 'http',
|
||||||
|
'host' => 'cakephp.org',
|
||||||
|
'path' => 'index.php',
|
||||||
|
'query' => 'somestring'
|
||||||
|
),
|
||||||
|
'method' => 'GET'
|
||||||
|
);
|
||||||
|
$response = $this->Socket->request($request);
|
||||||
|
$this->assertContains("GET /index.php?somestring HTTP/1.1", $this->Socket->request['line']);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The "*" asterisk character is only allowed for the following methods: OPTIONS.
|
* The "*" asterisk character is only allowed for the following methods: OPTIONS.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue