How to add a custom header for every request in Swagger-UI version 3.0

你离开我真会死。 提交于 2019-12-12 04:19:39

问题


I want to support multiple json versions on my swagger-ui version 3.0. The second json at every ajax call I want to add a custom header with name x-api-version and value 2

I tried this one:

$.ajaxSetup({
    beforeSend: function(xhr) {
        xhr.setRequestHeader('x-my-custom-header', 'some value');
    }
});

But it is not working. The documentation of swagger ui 3.0.0 is poor and I can't find a solution

来源:https://stackoverflow.com/questions/45085426/how-to-add-a-custom-header-for-every-request-in-swagger-ui-version-3-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!