title: Bottle POST method - getting query parameters
body: <p>I am trying to send a POST AJAX request to a Bottle server and read query_string parameters. 
  This works with GET method, but with POST, bottle.request.query_string is empty. </p>
  
  <p>This is with python 3.6.8. Bottle version in 0.12.17</p>
  
  <p>I'm stuck, please advise.</p>
  
  <p><strong>Bottle server:</strong></p>
  
  <pre><code>#!/usr/bin/env python3
  
  import bottle
  print(bottle.__version__)
  
  class EnableCors(object):
      name = "enable_cors"
      api = 2
  
      def apply(self, fn, context):
          def _enable_cors(*args, **kwargs):
              bottle.response.headers["Access-Control-Allow-Origin"] = "*"
              bottle.response.headers["Access-Control-Allow-Methods"] = "GET, POST, PUT, OPTIONS"
              bottle.response.headers["Access-Control-Allow-Headers"] = "Origin, Accept, Content-Type, X-Requested-With, X-CSRF-Token"
  
              if bottle.request.method != "OPTIONS":
                  return fn(*args, **kwargs)
  
          return _enable_cors
  
  application = bottle.app()
  application.install(EnableCors())
  
  @application.route("/api/params", method=['OPTIONS', 'POST'])
  def Api_Params():
      print('bottle.request.query_string:', bottle.request.query_string)
  
  
  bottle.run(host='0.0.0.0', port=8080, debug=True, reloader=True)
  </code></pre>
  
  <p><strong>Test javscript client:</strong></p>
  
  <pre><code>&lt;html&gt;
  
  &lt;head&gt;
      &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;script&gt;
  
  function test_post_param() {
  
      var data = {'e': 'E', 'f': 'F', 'g': {'aa':'AA', 'bb':'BB'}};
  
      $.ajax({
          url: 'http://127.0.0.1:8080/api/params',
  
          method: "POST",
          data: "key=a",
          // contentType: "text/plain",
  
          success: function (response, textStatus) {
              console.debug("test_post_param OK");
              console.debug(textStatus);
              console.debug(response);
          },
          error: function (response, textStatus) {
              console.debug("test_post_param ERR");
              console.debug(textStatus);
              console.debug(response);
          },
      })
  }
  
  
  window.onload = test_post_param;
  
  
  &lt;/script&gt;
  &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>