Support the ongoing development of Laravel.io →
Requests Input Testing
Last updated 2 years ago.

websterl3o liked this thread

1

It seems that the problem is cookie encryption. Laravel will delete the cookies that it can't decrypt. As test cookies is not created by laravel (I simply use an array to test cookies as seen in the previous post), they are not encrypted and they will be deleted. I can think of two solutions for this problem.

  1. Simply remove cookie middleware from the list in app/Http/Kernel.php. All cookies will be sent to and received from the client as they are. If you don't need encryption or you want to read some cookies in the client side this is a nice solution.

  2. Edit middleware so that it won't encrypt or decrypt cookies during testing. Just add a code to handle function that checks the environment and continues without doing anything if environment is testing. This middleware is in Illuminate/Cookie/Middleware/EncryptCookie.php. So a framework update will undo your editing in this file. If you need encrpytion this is your only solution.

Last updated 9 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.