2016-08-13 2 views
1

phpunit 테스트에서 서버로 보낸 get/post 요청에 jwt 토큰을 헤더로 포함하는 솔루션을 찾고 있습니다. GET/POST 호출에 헤더를 추가하는 옵션이 있습니까? 현재 서버에 GET 요청을 보내려면 다음 방법을 사용하고 있습니다.Laravel 5.1/phpunit - get/post 호출로 헤더 보내기

content = $ this-> get ('users/logout') -> response-> getContent();

답변

0

머리글 접두사로 HTTP_을 사용해야합니다. 예를 들어 :

$server = ['HTTP_X-Requested-With' => 'XMLHttpRequest']; 
$this->call('get', '/users/logout', [], [], $server); 

의 대체 문법 ::

$this->client->setServerParameter('HTTP_X-Requested-With', 'XMLHttpRequest'); 
$this->call('get', '/users/logout'); 

희망이 도움

관련 문제