Custom Header Parameters - (For Basic auth etc). Closes #53. Thanks @rintcius!

This commit is contained in:
Ayush Gupta
2012-08-31 10:32:15 +05:30
parent ec60488464
commit 1379f7ad1d
2 changed files with 15 additions and 1 deletions

View File

@@ -47,6 +47,7 @@ To use swagger-ui you should take a look at the [source of swagger-ui html page]
dom_id:"swagger-ui-container",
apiKey:"special-key",
supportHeaderParams: false,
headers: { "Authorization": "XXXX", "someOtherHeader": "YYYY" },
supportedSubmitMethods: ['get', 'post', 'put']
});
@@ -71,6 +72,11 @@ header parameters are supported. However because of [Cross-Origin Resource Shari
supportHeaderParams: true
### Custom Header Parameters - (For Basic auth etc)
If you have some header parameters which you need to send with every request, use the headers as below:
headers: { "Authorization": "XXXX", "someOtherHeader": "YYYY" }
### Api Key Parameter
If you enter an api key in swagger-ui, it sends a parameter named 'api\_key' as a query (or as a header param if you've enabled it as described above). You may not want to use the name 'api\_key' as the name of this parameter. You can change its name by setting the _apiKeyName_ parameter when you instantiate a SwaggerUI instance. For example to call it 'sessionId'