Can't include Authorization header with Laravel's unit tests -
after searching , testing different methods hours following seems way include authorization header unit tests inside laravel 5.2 jwt-auth:
$this->post(route('share.upload'), [ 'type' => 'video' ], ['http_authorization' => 'bearer ' . $token])....
what have tried beside that:
- using
authorization
instead ofhttp_authorization
- putting
['http_authorization' => 'bearer ' . $token]
inside['headers' => _here_ ]
also token generated correctly , i've used ->dump()
output , exception :
the token not parsed request
i dumped headers in middleware (that's placed before jwt.auth
) , there's authorization element: authorization
i thought heck , maybe it's because of lower case a!!! did same thing rest client(which returns successful response) same.
any ideas? thaaaanks
p.s: i've seen this: laravel testcase not sending authorization headers (jwt token)
you have check apache stripes authorization header. add following code .htaccess solve problem:
rewriteengine on rewritecond %{http:authorization} ^(.*) rewriterule .* - [e=http_authorization:%1]
alternative
of course, can add token url parameter instead of sending header.
Comments
Post a Comment