当我在 Laravel 中使用 unirest 时无法获得 JSON

Unable to get JSON when i am working with unirest in Laravel

我尝试了多次,但我不明白为什么我无法获取 JSON 数据。我通过 Composer 安装了 Unirest 但我仍然没有得到 JSON.
下面是我的控制器:


namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Unirest\Request as UnirestRequest;

class DomainController extends Controller
{
  public function index(){
    $headers = array('Accept' => 'application/json');
    $data = array('name' => 'ahmad', 'company' => 'mashape');
    $response = UnirestRequest::post('http://mockbin.com/request', $headers, $data);
    return $response->body;
  }
}

尝试将最后一行更改为 return response()->json($response->body);