Last active
February 25, 2017 15:21
-
-
Save ponelat/b5ff602aa56d80f7b614 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//... | |
window.swaggerUi = new SwaggerUi({ | |
url: url, | |
dom_id: "swagger-ui-container", | |
authorizations: { | |
someName: function() { | |
// This function will get called /before/ each request | |
// ... UNLESS you have a 'security' tag in the swagger.json file, in which case you must add 'someName' to the list of auths. | |
console.log('explore the request object...',this) // Take a look in the console tab to see what's available. | |
this.headers['x-swagger'] = 'value'; // Example header | |
return true; // there is a bug, fixed but not in develop_2.0 where returning true will only process _one_ interceptor, you can leave this if it's your only interceptor and when the fix is in, it'll work as expected | |
} | |
} | |
// ........... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment