title: App Script sends 405 response when trying to send a POST request
body: <p>I have published an app script publicly (Anyone, even anonymous) with a doPost method as follow,</p>
  <pre><code> function doPost(e){
      var sheet = SpreadsheetApp.getActiveSheet();
      var length = e.contentLength;
      var body = e.postData.contents;
      var jsonString = e.postData.getDataAsString();
      var jsonData = JSON.parse(jsonString);
      sheet.appendRow([jsonData.title, length]);
      var MyResponse = &quot;works&quot;;
      return ContentService.createTextOutput(MyResponse).setMimeType(ContentService.MimeType.JAVASCRIPT);
  }
  </code></pre>
  <p>When I sent a Post request with a JSON object with Advanced Rest Client it all works and return a 200 OK response. But when I try to send a post request with the react axios from a locally hosted react app it sends a 405 Response.</p>
  <pre><code>XMLHttpRequest cannot load https://script.google.com/macros/s/AKfycbzyc2CG9xLM-igL3zuslSmNY2GewL5seTWpMpDIQr_5eCod7_U/exec. Response for preflight has invalid HTTP status code 405
  </code></pre>
  <p>I have enabled cross origin resource sharing in the  browser as well. The function that sends the POST request is as follow,</p>
  <pre><code>axios({
            method:'post',
            url:'https://script.google.com/macros/s/AKfycbzyc2CG9xLM-igL3zuslSmNY2GewL5seTWpMpDIQr_5eCod7_U/exec',
            data: {
              &quot;title&quot;: 'Fred',
              &quot;lastName&quot;: 'Flintstone'
            }
          }).then(function (response) {
              console.log(response);
            })
            .catch(function (error) {
              console.log(error);
            });
  </code></pre>