Cookies 在swagger中设置自定义cookie和用户代理值
我们使用swagger来编写api文档 我面临着一个关于退出的问题。基本上,我们缩进以从swagger调用所需的其余端点 Cookie(例如:Cookie:token=xxxxx;)和用户代理(用户代理:自定义值;)参数 但是当我尝试设置这个参数时 Cookie未作为请求的一部分发送。 浏览器值正在覆盖用户代理。我试过firefox和chrome 我确实尝试过在线搜索,但没有找到合适的答案来解决我的问题,有人建议设置 useJQuery:true和withCredentials:true可设置cookies,但未正常工作Cookies 在swagger中设置自定义cookie和用户代理值,cookies,swagger,Cookies,Swagger,我们使用swagger来编写api文档 我面临着一个关于退出的问题。基本上,我们缩进以从swagger调用所需的其余端点 Cookie(例如:Cookie:token=xxxxx;)和用户代理(用户代理:自定义值;)参数 但是当我尝试设置这个参数时 Cookie未作为请求的一部分发送。 浏览器值正在覆盖用户代理。我试过firefox和chrome 我确实尝试过在线搜索,但没有找到合适的答案来解决我的问题,有人建议设置 useJQuery:true和withCredentials:true可设置c
对此有何建议?如他们的网站所示: 在OpenAPI 3.0术语中,cookie身份验证是发送的API密钥 在:饼干。例如,通过名为JSESSIONID的cookie进行身份验证 定义如下: 然后在端点级别:
paths:
/users:
get:
security:
- cookieAuth: [] # note the arbitrary name defined earlier
description: Returns a list of users.
responses:
'200':
description: OK
对于swagger:“2.0”
您可以这样定义cookie身份验证:
securityDefinitions:
cookieAuth:
type: apiKey
name:
Cookie # this is actually the Cookie header which will be sent by curl -H
in: cookie
在端点引用它的方式与OpenAPI 3相同
securityDefinitions:
cookieAuth:
type: apiKey
name:
Cookie # this is actually the Cookie header which will be sent by curl -H
in: cookie