如果我提出任何请求http://localhost:8000或http://127.0.0.1:8000它挂在状态挂起。(正如这里https://github.com/guzzle/guzzle/issues/1857)
有人告诉我这与暴饮暴食无关,我最好在这里问一下。
我在关注 laravel.com/docs/5.4/passport 时偶然发现了这个问题
这是挂起的代码:
$response = $http->post('http://your-app.com/oauth/token', [
'form_params' => [
'grant_type' => 'authorization_code',
'client_id' => 'client-id',
'client_secret' => 'client-secret',
'redirect_uri' => 'http://example.com/callback',
'code' => $request->code,
],
]);
Run Code Online (Sandbox Code Playgroud)
我尝试向工作 API 路由发出 GET 和 POST 请求(用邮递员测试),但在使用 guzzle 调用相同路由时它仍然挂起。
那么有没有办法在使用时向我自己的 API 发出请求php artisan serve?