laravel guzzlehttp - Server Exception in RequestException.php
<p>I am getting ServerException in RequestException.php line 107 when I make POST request to my API. I get following error -
Server error: <code>POST http://10.10.1.40:3000/auth/register</code> resulted in a <code>500 Internal Server Error response:
{"statusCode":500,"errorMessage":"[object Object]"}</code>.
I tried sending post request from REST Client and it works.
Following is the trace </p>

<pre><code>in RequestException.php line 107 at RequestException::create(object(Request), object(Response)) in Middleware.php line 65
at Middleware::GuzzleHttp\{closure}(object(Response)) in Promise.php line 199
at Promise::callHandler('1', object(Response), array(object(Promise),   object(Closure), null)) in Promise.php line 152
at Promise::GuzzleHttp\Promise\{closure}() in TaskQueue.php line 60
at TaskQueue-&gt;run(true) in Promise.php line 240
at Client-&gt;request('POST', 'http://10.10.1.40:3000/auth/register', array('body' =&gt; '{"firstName":"abc","lastName":"ab"}')) in RegisterController.php line 30
at RegisterController-&gt;postRegisterForm(object(Request))
</code></pre>

<p>Following is my controller code </p>

<pre><code>class RegisterController extends Controller{ 
    public function postRegisterForm(Request $request){ 
        $jsonData = json_encode($_POST);    
        $client = new Client(); 
        $res = $client-&gt;request('POST','10.10.1.40:3000/auth/register', ['body' =&gt; $jsonData]); 
        echo $res-&gt;getStatusCode();
        echo $res-&gt;getBody();   
    } 
}   
</code></pre>

<p>Any suggestions?</p>