laravel5.4でoauth-5-laravelを使用しています。
resource controllerを使ってルーティングしています。

アクセストークンは取得済みで、ブラウザ上でindex()のurlを入力するとjson形式でurlが返ってきますが、curlなどでリクエストを送るとhtmlコードがレスポンスされて、HTTPステータスコードは500となっています。

private $service = 'Instagram';

private $instagram;

function __construct()
{
    $this->instagram = \OAuth::consumer($this->service);
}

public function index()
{
    $result = json_decode($this->instagram->request('/users/self/media/recent'));
    $url = array();

    foreach ($result->data as $data) {
        $image = $data->images->standard_resolution;
        $url[] = str_replace("/s640x640/", "/s1080x1080/", $image->url);
    }
    return response()->json(['url' => $url]);
}

ちなみに

public function index()
{
    return ['test' => 'test'];
}

などであれば問題なく出力されるので、リクエストの部分が問題であると判断しましたが、なぜこのような記述であればレスポンスが返ってこないのかがわかりません。