title: Simple POST request works in Postman but not in browser
body: <p>I am experiencing an issue where a <code>POST</code> endpoint is returning a response when run in Postman but not when running it in the browser.</p>
  
  <p>I have setup an API endpoint on AWS via serverless. Here is the .yml config for that:</p>
  
  <pre><code>service: tableau-export-rest
  
  provider:
    name: aws
    runtime: nodejs10.x
    region: eu-west-1
    stage: ${opt:stage, 'dev'}
    timeout: 900
    memorySize: 3008
  
  functions:
    storeExportFiters:
      handler: index.storeExportFiters  
      events:
        - http: 
            path: /store-export-filters
            method: post
            cors: true 
  </code></pre>
  
  <p>The endpoint resolver <code>storeExportFiters</code> (which is a lambda) for now just returns a success message:</p>
  
  <pre><code>module.exports = (event, ctx, cb) =&gt; {
    return cb(null, {
      statusCode: 200,
      body: JSON.stringify({
        worked: true
      })
    });
  }
  </code></pre>
  
  <p>When I deploy this to AWS and try hitting the endpoint from Postman via a <code>POST</code> request with no body or anything it sends me the response fine. When I try do it in the browser however I get a <code>cors</code> error:</p>
  
  <blockquote>
    <p>Access to XMLHttpRequest at
    '<a href="https://myapi.com/store-export-filters" rel="nofollow noreferrer">https://myapi.com/store-export-filters</a>'
    from origin '<a href="http://localhost:9003" rel="nofollow noreferrer">http://localhost:9003</a>' has been blocked by CORS
    policy: No 'Access-Control-Allow-Origin' header is present on the
    requested resource.</p>
  </blockquote>
  
  <p>Here is the browser code used to try get a response from the endpoint. I am using <a href="https://www.npmjs.com/package/axios" rel="nofollow noreferrer">Axios</a> for the http request:</p>
  
  <pre><code>  axios.post('https://myapi.com/store-export-filters')
      .then(function (response) {
        console.log(response);
      })
      .catch(function (error) {
        console.log(error);
      });
  </code></pre>
  
  <p>I can't see why I would be getting a CORS error here especially as it works in Postman on my machine.</p>