title: Flask POST request is causing server to crash
body: <p>I am trying to make a simple api in Flask, the first step being getting the POST json data. (I just want to print it for now) This is my code and when I request /api with json data, it returns a 500 error. Any thoughts on why this is happening?</p>
  
  <pre><code>from flask import Flask, request, Response
  app = Flask(__name__)
  
  @app.route('/')
  def root_response():
      return "Hello World."
  
  @app.route('/api', methods=['POST', 'GET'])
  def api_response():
      if request.method == 'POST':
          return request.json
  
  if __name__ == '__main__':
      app.run()
  </code></pre>
  
  <p>The curl command:</p>
  
  <pre><code>$ curl -H "Content-Type: application/json" --data @body.json http://127.0.0.1:5000/api
  &lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"&gt;
  &lt;title&gt;500 Internal Server Error&lt;/title&gt;
  &lt;h1&gt;Internal Server Error&lt;/h1&gt;
  &lt;p&gt;The server encountered an internal error and was unable to complete your request.  Either the server is overloaded or there is an error in the application.&lt;/p&gt;
  </code></pre>
  
  <p>body.json:</p>
  
  <pre><code>{
  "please": "print",
  "me": "now"
  }
  </code></pre>