inertiajs/inertia-laravel

assertInertia() fails when testing Inertia visits

ignacio-dev opened this issue · 1 comments

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')
    );

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!