After searching and testing different methods for hours the following seems to be the way to include an authorization header with unit tests inside Laravel 5.2 for jwt-auth:
'type' => 'video'
], ['HTTP_Authorization' => 'Bearer ' . $token])....
What I have tried beside that:
Authorization instead of
['HTTP_Authorization' => 'Bearer ' . $token] inside
['headers' => _HERE_ ]
Also the token is generated correctly and I've used
->dump() to get the output and the exception is :
The token could not be parsed from the request
I dumped the headers in a middleware (that's placed before
jwt.auth) and there's an authorization element:
I thought what the heck , maybe it's because of the lower case a!!!
But then did the same thing with my rest client(which returns a successful response) but it was just the same.
Any ideas? Thaaaanks
P.S: I've also seen this: Laravel TestCase not sending Authorization headers (JWT Token)