title: CORS: No pre-flight on GET but a pre-flight on POST
body: <p>I'm trying to remove the unnecessary pre-flight requests in my application. For it I've simplified some parts of request, removed custom headers etc. But got stuck on a problem - GET requests now work fine without pre-flights, but POST requests still have them.</p>
  
  <p>I've followed the requirements:</p>
  
  <ol>
  <li>Request does not set custom HTTP headers.</li>
  <li>Content type is "text/plain; charset=utf-8".</li>
  <li>The request method has to be one of GET, HEAD or POST. If POST, content type should be one of application/x-www-form-urlencoded, multipart/form-data, or text/plain.</li>
  </ol>
  
  <p>Both GET and POST requests go through the single httpinvoke call.</p>
  
  <p>As an example - GET request that is not prefaced by pre-flight:</p>
  
  <blockquote>
    <p>URL: <code>http://mydomain/APIEndpoint/GETRequest?Id=346089&amp;Token=f5h345</code></p>
    
    <p>Request Method:GET</p>
    
    <p><strong>Request Headers</strong>:</p>
    
    <p>Accept:<code>*/*</code> </p>
    
    <p>Accept-Encoding:gzip, deflate</p>
    
    <p>Accept-Language:uk-UA,uk;q=0.8,ru;q=0.6,en-US;q=0.4,en;q=0.2</p>
    
    <p>Cache-Control:no-cache</p>
    
    <p>Connection:keep-alive </p>
    
    <p>Content-Type:text/plain; charset=utf-8 </p>
    
    <p>Host: correct host </p>
    
    <p>Origin:<code>http://localhost</code></p>
    
    <p>Pragma:no-cache </p>
    
    <p>Referer: correct referer </p>
    
    <p>User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36</p>
    
    <p><strong>Query String Parameters</strong>: </p>
    
    <p>Id=346089</p>
    
    <p>Token=f5h345</p>
  </blockquote>
  
  <p>And a POST request that looks very similar but is still prefaced with pre-flight:</p>
  
  <blockquote>
    <p>URL: <code>http://mydomain/APIEndpoint/GETRequest?param=TEST</code> </p>
    
    <p>Request Method:POST</p>
    
    <p><strong>Request Headers:</strong></p>
    
    <p>Accept:<code>*/*</code></p>
    
    <p>Accept-Encoding:gzip, deflate</p>
    
    <p>Accept-Language:uk-UA,uk;q=0.8,ru;q=0.6,en-US;q=0.4,en;q=0.2</p>
    
    <p>Cache-Control:no-cache </p>
    
    <p>Connection:keep-alive </p>
    
    <p>Content-Length:11</p>
    
    <p>Content-Type:text/plain; charset=UTF-8 </p>
    
    <p>Host:</p>
    
    <p>Origin:<code>http://localhost</code> </p>
    
    <p>Pragma:no-cache </p>
    
    <p>Referer: 
    User-Agent:Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36</p>
    
    <p><strong>Query String Parameters:</strong></p>
    
    <p>param:TEST</p>
    
    <p><strong>Request Payload</strong></p>
    
    <p>{MyData: {}}</p>
  </blockquote>
  
  <p>Any advice would be appreciated! Thanks!</p>
  
  <p>==== Update ===</p>
  
  <p>As requested, posting the pre-flight request for the POST request:</p>
  
  <blockquote>
    <p>URL: <code>http://mydomain/APIEndpoint/GETRequest?param=TEST</code></p>
    
    <p>Request Method:OPTIONS</p>
    
    <p>Status Code:200 OK</p>
    
    <p><strong>Response Header</strong></p>
    
    <p>Access-Control-Allow-Origin:<code>*</code></p>
    
    <p>Cache-Control:no-cache</p>
    
    <p>Content-Length:0</p>
    
    <p>Date:Wed, 09 Aug 2017 08:02:16 GMT</p>
    
    <p>Expires:-1</p>
    
    <p>Pragma:no-cache</p>
    
    <p>Server:Microsoft-IIS/8.5</p>
    
    <p>X-AspNet-Version:4.0.30319</p>
    
    <p>X-Powered-By:ASP.NET</p>
    
    <p><strong>Request Headers</strong></p>
    
    <p>Accept:<code>*/*</code></p>
    
    <p>Accept-Encoding:gzip, deflate</p>
    
    <p>Accept-Language:uk-UA,uk;q=0.8,ru;q=0.6,en-US;q=0.4,en;q=0.2</p>
    
    <p>Access-Control-Request-Method:POST</p>
    
    <p>Cache-Control:no-cache</p>
    
    <p>Connection:keep-alive</p>
    
    <p>Host:correct host</p>
    
    <p>Origin:<code>http://localhost</code></p>
    
    <p>Pragma:no-cache</p>
    
    <p>Referer: correct referer</p>
    
    <p>User-Agent:Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36</p>
    
    <p><strong>Query String Parameters</strong></p>
    
    <p>param:TEST</p>
  </blockquote>
  
  <p>It's a legacy code which uses the httpinvoke library. Code snippet that actually does the call:</p>
  
  <pre><code>_converters: {
      'text json': function (input, reviver) {},
      'json text': JSON.stringify
  };
  
  headers = {
      'Content-Type': 'text/plain; charset=utf-8'
  };
  
  data = {params: "test"};
  
  httpinvoke(url, method.toUpperCase(), {
      corsExposedHeaders: ['Content-Type'],
      headers: headers,
      input: data,
      converters: _converters,                
      inputType: 'json',
      outputType: 'json',
      timeout: self._getMessageTimeout()
  }).then(function (res) {}, function (error) {});
  </code></pre>