I am trying to make a test work. I use a REST client, "Postman" to send a POST request with an object to Laravel. The idea is to get back the request as an object. But I don't think I am getting the right result.
In Postman, I specify the adress to send to, choose "POST", and then send this:
{
"url": "http://testingtesting.com"
}
In Laravel I have a Route to the adress:
Route::post('api/test', 'TestController@index');
and the controller should return the json object. If I do this:
class TestController extends BaseController{
public function index(){
$input = Input::json()->all();
var_dump($input);
}
}
I get back an array in POSTman:
array (size=1)
'url' => string 'http://testingtesting.com' (length=18)
That's when I look at "preview". If I switch to "Pretty" it shows like this:
<pre class='xdebug-var-dump' dir='ltr'>
<b>array</b>
<i>(size=1)</i>
'url'
<font color='#888a85'>=></font>
<small>string</small>
<font color='#cc0000'>'http://testing.com'</font>
<i>(length=18)</i>
</pre>
but I'm supposed to get an object(stdClass), not an array. What do I need to do?