我正在使用 Swagger UI 生成 api doc,并希望在此页面中为葡萄 api 调用 api。我将security_definitions设置如下:
add_swagger_documentation(
hide_documentation_path: true,
doc_version: '18.0',
mount_path: '/api_doc',
add_version: true,
hide_format: true,
info: {
title: "Search API documentation"
},
security_definitions: {
ApiKeyAuth:{
type: "apiKey",
name: "X-Auth-Token",
in: "header",
description: "Requests should pass an api_key header."
}
},
security: {
ApiKeyAuth: []
}
)
但是当输入值并发送请求时,请求头中没有值。