title: swagger-ui : Add authorization header don't work
body: <p>I want to add basic authorization in swagger-ui, to test my WS with "Try it out" button. I tried from <a href="https://github.com/swagger-api/swagger-ui#header-parameters" rel="nofollow noreferrer">swagger documentation</a>, and this topic <a href="https://stackoverflow.com/questions/31057343/adding-basic-authorization-for-swagger-ui">Adding Basic Authorization for Swagger-UI</a>, but no one work. No header is added in request, but in curl command, the basic authorization header is present. If I copy paste this curl command, all is ok.</p>
  
  <p>My swagger-ui version is 2.1.2. I downloaded from github, ant put directly dist folder in static folder of my server.</p>
  
  <p>Here my index.html :</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta charset="UTF-8"&gt;
  &lt;title&gt;Sensor API documentation&lt;/title&gt;
  &lt;link rel="icon" type="image/png" href="images/favicon-32x32.png" sizes="32x32" /&gt;
  &lt;link rel="icon" type="image/png" href="images/favicon-16x16.png" sizes="16x16" /&gt;
  &lt;link href='css/typography.css' media='screen' rel='stylesheet' type='text/css' /&gt;
  &lt;link href='css/reset.css' media='screen' rel='stylesheet' type='text/css' /&gt;
  &lt;link href='css/screen.css' media='screen' rel='stylesheet' type='text/css' /&gt;
  &lt;link href='css/reset.css' media='print' rel='stylesheet' type='text/css' /&gt;
  &lt;link href='css/print.css' media='print' rel='stylesheet' type='text/css' /&gt;
  &lt;script src='lib/jquery-1.8.0.min.js' type='text/javascript'&gt;&lt;/script&gt;
  &lt;script src='lib/jquery.slideto.min.js' type='text/javascript'&gt;&lt;/script&gt;
  &lt;script src='lib/jquery.wiggle.min.js' type='text/javascript'&gt;&lt;/script&gt;
  &lt;script src='lib/jquery.ba-bbq.min.js' type='text/javascript'&gt;&lt;/script&gt;
  &lt;script src='lib/handlebars-2.0.0.js' type='text/javascript'&gt;&lt;/script&gt;
  &lt;script src='lib/underscore-min.js' type='text/javascript'&gt;&lt;/script&gt;
  &lt;script src='lib/backbone-min.js' type='text/javascript'&gt;&lt;/script&gt;
  &lt;script src='swagger-ui.js' type='text/javascript'&gt;&lt;/script&gt;
  &lt;script src='lib/highlight.7.3.pack.js' type='text/javascript'&gt;&lt;/script&gt;
  &lt;script src='lib/marked.js' type='text/javascript'&gt;&lt;/script&gt;
  &lt;script src='lib/swagger-oauth.js' type='text/javascript'&gt;&lt;/script&gt;
  
  &lt;!-- Some basic translations --&gt;
  &lt;!-- &lt;script src='lang/translator.js' type='text/javascript'&gt;&lt;/script&gt; --&gt;
  &lt;!-- &lt;script src='lang/ru.js' type='text/javascript'&gt;&lt;/script&gt; --&gt;
  &lt;!-- &lt;script src='lang/en.js' type='text/javascript'&gt;&lt;/script&gt; --&gt;
  
  &lt;script type="text/javascript"&gt;
      $(function() {
  
          // Pre load translate...
          if (window.SwaggerTranslator) {
              window.SwaggerTranslator.translate();
          }
          window.swaggerUi = new SwaggerUi({
              url : "/swagger/json/SensorAPI.json",
              validatorUrl : "",
              dom_id : "swagger-ui-container",
              supportedSubmitMethods : [ 'get', 'post', 'put', 'delete', 'patch' ],
              onComplete : function(swaggerApi, swaggerUi) {
  
                  if (window.SwaggerTranslator) {
                      window.SwaggerTranslator.translate();
                  }
  
                  $('pre code').each(function(i, e) {
                      hljs.highlightBlock(e)
                  });
                  addAuthorization();
  
              },
              onFailure : function(data) {
                  log("Unable to Load SwaggerUI");
              },
              docExpansion : "none",
              apisSorter : "alpha",
              showRequestHeaders : false
          });
  
          function addAuthorization() {
              var username = $('#input_username').val();
              var password = $('#input_password').val();
              if (username &amp;&amp; username.trim() != "" &amp;&amp; password &amp;&amp; password.trim() != "") {
                  var basicAuth = new SwaggerClient.PasswordAuthorization(username, password);
                  window.swaggerUi.api.clientAuthorizations.add('Basic', basicAuth);
                  log("authorization added: username = " + username + ", password = " + password);
              } else {
                  window.authorizations.remove();
              }
          }
          $('#input_username').change(addAuthorization);
          $('#input_password').change(addAuthorization);
          // pre-populate on the page using demo account
          $('#input_username').val("demo");
          $('#input_password').val("demo");
  
          window.swaggerUi.load();
  
          function log() {
              if ('console' in window) {
                  console.log.apply(console, arguments);
              }
          }
      });
  &lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body class="swagger-section"&gt;
      &lt;div id='header'&gt;
          &lt;div class="swagger-ui-wrap"&gt;
              &lt;a id="logo" href="http://swagger.io"&gt;swagger&lt;/a&gt;
              &lt;form id='api_selector'&gt;
                  &lt;div class='input'&gt;
                      Username: &lt;input placeholder="username" id="input_username" name="username" type="text" size="10" /&gt;
                  &lt;/div&gt;
                  &lt;div class='input'&gt;
                      Password: &lt;input placeholder="password" id="input_password" name="password" type="password" size="10" /&gt;
                  &lt;/div&gt;
              &lt;/form&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  
      &lt;div id="message-bar" class="swagger-ui-wrap" data-sw-translate&gt;&amp;nbsp;&lt;/div&gt;
      &lt;div id="swagger-ui-container" class="swagger-ui-wrap"&gt;&lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Please tell me what is wrong. Thanks</p>