inertiajs / inertia-laravel

The Laravel adapter for Inertia.js.
https://inertiajs.com
MIT License
1.99k stars 222 forks source link

assertInertia() fails when testing Inertia visits #613

Closed ignacio-dev closed 2 months ago

ignacio-dev commented 2 months ago

assertInertia() throws a Not a valid Inertia response error when simulating an Inertia.js visit like so:

$response = $this
    ->withHeaders([
        "accept" => "text/html, application/xhtml+xml",
        "content-type" => "application/json",
        "x-inertia" => "true",
        "x-inertia-partial-component" => "Post/Edit",
        "x-inertia-partial-data" => "post",
        "x-inertia-version" => "eaa52f64811e388602bb56eca093f022",
        "x-requested-with" => "XMLHttpRequest",
    ])
    ->get('/some-route')
    ->assertInertia(fn (AssertableInertia $page) => $page
        ->has('post')
    );
driesvints commented 2 months ago

Hey there,

Can you first please try one of the support channels below? If you can actually identify this as a bug, feel free to open up a new issue with a link to the original one and we'll gladly help you out.

Thanks!