In my acceptance test, I am trying to send a JSON request with a cookie:
// CartTest.php
$response = $this->postJson(route('carts.store'), [], [
'Cookie' => 'uuid='.Crypt::encrypt($cart->uuid)
]);
When I do $request->hasCookie('uuid')
at the controller, I get false
.
I also tried different variations, like Set-Cookie
, HTTP_SET_COOKIE
, etc. but none of them seem to work. I'd prefer to pass the cookie with postJson
instead of the generic call
for brevity.
Any ideas? Thanks