Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; (function swaggerAddCustomHeaders() {
- var addAuthorization = function () {
- var self = $(this),
- val = self.val();
- if (val) {
- var headerName = self.data('header');
- swaggerUi.api.clientAuthorizations.add(headerName, new SwaggerClient.ApiKeyAuthorization(headerName, val, "header"));
- }
- },
- addCustomHeaderEditor = function (name) {
- $('<div class="input"><input placeholder="' + name + '" id="' + name + '" data-header="' + name + '" type="text" size="10"></div>')
- .insertBefore('#api_selector div.input:last-child');
- $('#' + name).change(addAuthorization);
- if (window.localStorage) {
- if (window.localStorage[name]) {
- $('#' + name).val(window.localStorage[name]);
- $('#' + name).change();
- }
- }
- };
- $("#input_apiKey, #explore").hide();
- addCustomHeaderEditor('X-TOKEN');
- addCustomHeaderEditor('Company');
- addCustomHeaderEditor('Mobile');
- })();
Advertisement
Add Comment
Please, Sign In to add comment