swagger-ui 3.0.6 - 添加自定义授权标头客户端(通过 javascript 下拉 onchange 事件) [英] swagger-ui 3.0.6 - Add custom authorization header client side (through javascript dropdown onchange event)
问题描述
我有兴趣了解如何使用 swagger-ui 3.0.6 将我的自定义授权标头自动添加到所有试用"请求中.
在我的前端页面中,我有一个包含多个授权标头值的下拉列表.因此,我对 swagger 2.x 所做的是一个带有 onchange 事件的 javascript 函数,该函数将选定的 authorization header 值注入到 swaggerUI 实例中.
我无法使用 swagger-ui 3.0.6 重现此机制.有人可以帮助我吗?
这个问题与这个 有关一个.
谢谢
I'm interested to understand how to auto-add my custom authorization header to all "try it out" requests with swagger-ui 3.0.6.
In my frontend page I have a dropdown that contains multiple authorization header values. So, what I did with swagger 2.x it was a javascript function with an onchange event that injected the selected authorization header value in the swaggerUI instance.
I cannot reproduce this mechanism with swagger-ui 3.0.6.
Someone could help me?
This question is releated to this one.
Thanks
推荐答案
在我的前端页面中,我有一个包含多个授权标头值的下拉列表.所以,我对 swagger 2.x 所做的是一个带有 onchange 事件的 javascript 函数,它在 swaggerUI 实例中注入了选定的授权标头值.
我无法用 swagger-ui 3.0.6 重现这种机制
In my frontend page I have a dropdown that contains multiple authorization header values. So, what I did with swagger 2.x it was a javascript function with an onchange event that injected the selected authorization header value in the swaggerUI instance.
I cannot reproduce this mechanism with swagger-ui 3.0.6
Swagger UI 3.0.x 尚不支持以编程方式添加授权标头.这在 https://github.com/swagger-api/swagger 中被跟踪-ui/issues/2793.
Adding authorization headers programmatically is not supported yet in Swagger UI 3.0.x. This is being tracked in https://github.com/swagger-api/swagger-ui/issues/2793.
这篇关于swagger-ui 3.0.6 - 添加自定义授权标头客户端(通过 javascript 下拉 onchange 事件)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!