mercredi 17 avril 2019

Laravel request using guzzle does not respond

This works fine: screenshot insomnia

But when I try to do the same thing through an api route(POST http://127.0.0.1:8000/api/login), which correctly leads to this login-function, I do not get a response. I set the timeout to end the request, otherwise it keeps 'looping' in the get-request. Why doesn't this work?

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use GuzzleHttp\Client;

class AuthController extends Controller
{
    public function login(Request $request)
    {
        $client = new Client([
            'timeout'  => 8.0,
        ]);
        $response = $client->get('http://127.0.0.1:8000/api/all');

        return response()->json($response);
    }

}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire