title: ajax post - I want to change the Accept-Encoding header value
body: <p>I am using jQuery ajax to call my WCF service with an HTTP POST. The response is GZIP encoded, and this causes problems in my environment. (See <a href="https://stackoverflow.com/questions/7384176/wcf-service-returns-incorrect-content-length-when-using-gzip-encoding">this question</a>). If the response is not GZIP encoded everything is fine.</p>
  
  <p>So looking in Fiddler, I see that the jQuery generated query has the following headers:</p>
  
  <pre><code>Accept-Encoding: gzip,deflate,sdch
  </code></pre>
  
  <p>If, via fiddler, i change this value to <code>None</code>, then the response is not compressed, which is what I want. All that I need to do is change the value in the "Accept-Encoding" header.</p>
  
  <p>It seems that it is not possible to change this header value via the <code>.ajax</code> command. (See <a href="http://forum.jquery.com/topic/jquery-ajax-beforesend-accept-encoding-behavior" rel="noreferrer">this forum post</a>).</p>
  
  <p>Can anyone tell me what options I have to change this header value.</p>
  
  <p>Here's my current attempt. My <code>headers</code> parameter seems to be ignored.</p>
  
  <pre><code>    $telerik.$.ajaxSetup({
          accepts: 'application/json, text/javascript, */*'
      });
  
      var parameters = {
          "playerId": args.playerId
      };
  
      var dataInJsonFormat = '{ "playerId": ' + args.playerId + '}';
  
      var ajaxCallParameters = {
          accepts: 'application/json, text/javascript, */*',
          async: true,
          cache: false,
          contentType: "application/json; charset=utf-8",
          url: "../Services/CmsWebService.svc/SendUpdateRequestToPlayer",
          headers: { "Accept-Encoding" : "None" },
          type: "POST",
          data: dataInJsonFormat,
          dataType: 'json',
          error: function (jqXHR, textStatus, errorThrown) {
              var errorString = 'Error thrown from ajax call: ' + textStatus + 'Error: ' + errorThrown;
              var displayPanel = document.getElementById('requestStatusUpdateResults');
              $telerik.$(displayPanel).text(errorString);
  
          },
          success: function (data, textStatus, jqXHR) {
              var displayPanel = document.getElementById('requestStatusUpdateResults');
              $telerik.$(displayPanel).text(data.d);
          }
      };
  
      $telerik.$.ajax(ajaxCallParameters);
  </code></pre>