Added test case.

This commit is contained in:
李铭昕 2020-06-16 15:58:06 +08:00
parent 1ca339fa06
commit 463d048bb0
2 changed files with 14 additions and 0 deletions

View File

@ -1,5 +1,9 @@
# v1.1.33 - TBD
## Fixed
- [#1917](https://github.com/hyperf/hyperf/pull/1917) Fixed bug that `Request::isXmlHttpRequest` does not work.
## Optimized
- [#1793](https://github.com/hyperf/hyperf/pull/1793) Socket.io server now only dispatch connect/disconnect events in onOpen and onClose. Also upgrade some class members from private to protected, so users can hack them.

View File

@ -12,6 +12,7 @@ declare(strict_types=1);
namespace HyperfTest\HttpMessage;
use Hyperf\HttpMessage\Base\Request;
use Hyperf\HttpMessage\Server\Request as ServerRequest;
use PHPUnit\Framework\TestCase;
/**
@ -38,4 +39,13 @@ class MessageTraitTest extends TestCase
$this->assertSame('1000', $request->getHeaderLine('1000'));
$this->assertSame('XMLHttpRequest', $request->getHeaderLine('X-Requested-With'));
}
public function testIsXmlHttpRequest()
{
$request = new ServerRequest('GET', '/', [
'X-Requested-With' => 'XMLHttpRequest',
]);
$this->assertTrue($request->isXmlHttpRequest());
}
}