title: Edit incoming request body payloads in flask api
body: <p>Im looking to make my Flask based API case insensitive for all incoming payloads. rather than having to apply this to all api-route functions i want to apply this to the <code>@app.before_request</code> decorator, such that for all incoming requests with json payloads (POSTs and PUTs) I directly edit the payload before it is handled by the applicable <code>app.route</code> function.</p>
  
  <p><code>POST {"x":1, "Y":2}</code> Should be formatted to <code>POST {"x":1, "y":2}</code> for request endpoints, but I can't seem to make this happen.</p>
  
  <pre><code>@app.before_request
  def before_request():
      if request.json:
          data = RecusivelyLowerKeys(request.get_json())
          request.data = json.dumps(ldata)
  </code></pre>
  
  <p>so far this approach hasn't worked and the original request payload seems static.</p>
  
  <p>Any tips or alternative approaches would be appreciated thanks.</p>