From 3b590d8fe828d7de75667e89ced30089e74538ec Mon Sep 17 00:00:00 2001 From: Samuel Girardin Date: Fri, 29 Oct 2021 15:30:50 +0200 Subject: [PATCH] fix test project and warning about inertia middleware order --- README.md | 5 ++++- tests/integrations/Kernel.py | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index af95b29..ac29e27 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/tests/integrations/Kernel.py b/tests/integrations/Kernel.py index ca27602..98b124e 100644 --- a/tests/integrations/Kernel.py +++ b/tests/integrations/Kernel.py @@ -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],