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 also using Insomnia), 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);
}
}
/api/all
instead? – thisiskelvin