我正在尝试测试 swagger 登录 API,它显示 404 错误:未找到
。我正在使用护照身份验证进行登录。请帮我解决这个问题。
使用 swagger 评论:
/**
* @OA\Post(
* path="api/auth/login",
* tags={"Login"},
* summary="Login",
* operationId="login",
*
* @OA\Parameter(
* name="email",
* in="query",
* required=true,
* @OA\Schema(
* type="string"
* )
* ),
* @OA\Parameter(
* name="password",
* in="query",
* required=true,
* @OA\Schema(
* type="string"
* )
* ),
* )
**/
请求 curl :
curl -X POST "http://localhost/minidmsapiapi/auth/login?email=info%40vibhaa.in&password=password" -H "accept: application/json" -H "X-CSRF-TOKEN: WBZZ8H8OEiQzZJe2VEMviscfZKehbExrkeQD4LW4"
请求地址:
http://localhost/minidmsapiapi/auth/login?email=info%40vibhaa.in&password=password
最佳答案
确保您使用的是在文档->路由数组中列出的相同 url 以使用浏览器访问。例如
'routes' => [
'api' => 'api/docs',
],
所以你可以看到'routes'数组'api'变量中的url(端点)值是“api/docs”所以我将使用http://127.0.0.1:8000/api/docs用于访问文档。
关于curl - 如何解决 404 错误 : Not Found in swagger while testing the api in Laravel 6,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58452144/