mirror of
https://gitee.com/hyperf/hyperf.git
synced 2024-11-29 18:27:44 +08:00
fix and add test
This commit is contained in:
parent
7994e552ac
commit
1ca339fa06
@ -439,7 +439,7 @@ class Request extends \Hyperf\HttpMessage\Base\Request implements ServerRequestI
|
||||
*/
|
||||
public function isXmlHttpRequest()
|
||||
{
|
||||
return $this->getHeader('X-Requested-With') == 'XMLHttpRequest';
|
||||
return $this->getHeaderLine('X-Requested-With') == 'XMLHttpRequest';
|
||||
}
|
||||
|
||||
public function getSwooleRequest(): \Swoole\Http\Request
|
||||
|
@ -29,11 +29,13 @@ class MessageTraitTest extends TestCase
|
||||
'X-Id' => $id,
|
||||
'Version' => 1.0,
|
||||
1000 => 1000,
|
||||
'X-Requested-With' => 'XMLHttpRequest',
|
||||
]);
|
||||
|
||||
$this->assertSame($token, $request->getHeaderLine('X-Token'));
|
||||
$this->assertSame((string) $id, $request->getHeaderLine('X-Id'));
|
||||
$this->assertSame('1', $request->getHeaderLine('Version'));
|
||||
$this->assertSame('1000', $request->getHeaderLine('1000'));
|
||||
$this->assertSame('XMLHttpRequest', $request->getHeaderLine('X-Requested-With'));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user