wordnik/swagger.js — pull request #4 by rintcius (2012-08-30 23:01:37+00:00)
Title: allow setting headers globally in swaggerApi

this patch enables setting headers like this:

window.swaggerUi = new SwaggerUi({
discoveryUrl:"http://petstore.swagger.wordnik.com/api/resources.json",
dom_id:"swagger-ui-container",
headers: { "Authorization": "XXXX", "someOtherHeader": "YYYY" },
supportHeaderParams: true,
supportedSubmitMethods: ['get', 'post', 'put']
});

These headers will then be sent with every request. This is what i use for Basic Auth. so it could also address https://github.com/wordnik/swagger-ui/issues/53 (although this patch is not tied to the api key)