【发布时间】:2018-10-04 11:35:23
【问题描述】:
Swagger UI 拒绝使用 自签名证书 向 https 发出请求。
问题来了:
curl -X POST "https://localhost:8088/Authenticate" -H "accept: pplication/json" -H "Content-Type: application/json" -d "{ \"username\":"user\", \"password\": \"user\"}"
上面的命令是swagger自动生成的,运行后返回:
TypeError: Failed to fetch
手动(不使用 Swagger UI)运行返回:
curl: (60) SSL certificate problem: self signed certificate
More details here: https://curl.haxx.se/docs/sslcerts.html
curl failed to verify the legitimacy of the server and therefore could not
establish a secure connection to it. To learn more about this situation and
how to fix it, please visit the web page mentioned above.
我想让它像下一个(添加 --insecure 参数):
curl -X POST "https://localhost:8088/Authenticate" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"username\": \"user\", \"password\": \"user\"}" --insecure
这将允许我执行所需的请求。有没有办法向自动生成的 Swagger curl 添加自定义参数?谢谢。
【问题讨论】:
标签: swagger swagger-ui openapi