Skip to content

Commit

Permalink
fix test project and warning about inertia middleware order
Browse files Browse the repository at this point in the history
  • Loading branch information
girardinsamuel committed Oct 29, 2021
1 parent 6c83092 commit 3b590d8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,12 @@ Inertia adapter comes with a middleware that will control some of the flow of da
from masonite.inertia import InertiaMiddleware

class AppHttpKernel(HttpKernel):
http_middleware = [InertiaMiddleware]
http_middleware = [InertiaMiddleware, EncryptCookies]
```

Make sure that this middleware is added before the EncryptCookies middleware else you will get
some issues with CSRF token validation as `XSRF-TOKEN` value won't be encrypted.

Finally publish the package configuration (to get `config/inertia.py`) to your project:

```bash
Expand Down
3 changes: 2 additions & 1 deletion tests/integrations/Kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@
from masonite.storage import StorageCapsule
from masonite.utils.location import base_path
from masonite.utils.structures import load
from src.masonite.inertia import InertiaMiddleware

from .app.middleware.VerifyCsrfToken import VerifyCsrfToken


class Kernel:

http_middleware = [EncryptCookies]
http_middleware = [InertiaMiddleware, EncryptCookies]

route_middleware = {
"web": [SessionMiddleware, LoadUserMiddleware, VerifyCsrfToken],
Expand Down

0 comments on commit 3b590d8

Please sign in to comment.