dimanche 14 mai 2017

laravel Invalid JSON was returned from the route. Perhaps an exception was thrown?

This is my test for store function

 /** @test */
    public function storeTest()
    {  
       $this->be($this->user);
       $response = $this->json('POST','/client/ocp/profile/247/route-',[
                     'name' => 'Test store',
                     'speed' => 4.5,
                     'created_by' => $this->user->id,
                     'client_id' => '262',

                   ]);
        $response
                ->seeStatusCode(302)
                ->seeJson(['status' => 'OK']);

    }

when i run it i got this error

Invalid JSON was returned from the route. Perhaps an exception was thrown?

i try to add this header to solve a problem
['X-Requested-With' => 'XMLHttpRequest'] but it not solving

how i can solve this?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire