Discovered the answer: json_decode($response->getBody()->getContents()); when I was using $response->json(); on a successful response.
May 26, 2015
2
Level 2
Form Request, 422 Error and Guzzle
Has anyone worked with Form Requests and a Guzzle client request? I'm trying to access the errors collection being returned by Laravel via the wantsJson() JsonResponse($errors,422) response and I'm seeing the 422 and Unprocessable Entity string but I can't see a way of accessing the errors array.
The documentation from Guzzle suggests a GuzzleHttp\Exception\ClientException will be thrown for the 400 errors but there is no mention of a getBody() on the getResponse() method.
I've found lots of jquery/ajax examples of catching the errors but not via a curl method.
Thanks
Level 2
1 like
Please or to participate in this conversation.