我在测试 Laravel 5.5 时遇到问题。我需要在 TEST HEADER 中发送不记名令牌,但不起作用
public function testAuthCheckinvalidToken()
{
$response = $this->withHeaders([
'Accept' => 'application/json',
'Content-Type' => 'application/json',
'Authorization' => 'Bearer ' . $this->token,
])->json('GET', 'auth/check');
...
}
当我 dd($response) 时,只设置了默认的 HEADERS:
#headers: array:5 [
"cache-control" => array:1 [
0 => "no-cache, private"
]
"date" => array:1 [
0 => "Tue, 21 Nov 2017 18:48:27 GMT"
]
"content-type" => array:1 [
0 => "application/json"
]
"x-ratelimit-limit" => array:1 [
0 => 60
]
"x-ratelimit-remaining" => array:1 [
0 => 59
]
]
我的标题没有出现。我认为我是对的