title: flask returns 400 on post request from postman
body: <p>I'm doing a flask course on lynda and had trouble with an example. 
  <a href="https://www.lynda.com/Flask-tutorials/Web-API-Development-Flask/521200-2.html" rel="nofollow noreferrer">https://www.lynda.com/Flask-tutorials/Web-API-Development-Flask/521200-2.html</a></p>
  
  <p>I'm doing a simple post and it works when from a basic webform but fails from postman. I think it's because postman encodes the request different, but can't figure out why it does that or why flask can't read it. </p>
  
  <p>Postman:
  <a href="https://i.stack.imgur.com/boUzm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/boUzm.png" alt="enter image description here"></a></p>
  
  <p>Request intercepted in Charles:</p>
  
  <pre><code>POST /api/candidate HTTP/1.1
  Host: localhost:5000
  Content-Length: 248
  Postman-Token: 285ed4d8-2af6-0eb6-8de7-e8ecb41fb86e
  Cache-Control: no-cache
  Origin: chrome-extension://fhbjgbiflinjbdggehcddcbncdddomop
  User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.95 Safari/537.36
  Content-Type: application/x-www-form-urlencoded
  Accept: */*
  Accept-Encoding: gzip, deflate, br
  Accept-Language: en-US,en;q=0.8
  
  ------WebKitFormBoundary3Q45bnchdpXxtZbw
  Content-Disposition: form-data; name="first_name"
  
  Susan
  ------WebKitFormBoundary3Q45bnchdpXxtZbw
  Content-Disposition: form-data; name="last_name"
  
  Kruger
  ------WebKitFormBoundary3Q45bnchdpXxtZbw--
  </code></pre>
  
  <p>Return:</p>
  
  <pre><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"&gt;
  &lt;title&gt;400 Bad Request&lt;/title&gt;
  &lt;h1&gt;Bad Request&lt;/h1&gt;
  &lt;p&gt;The browser (or proxy) sent a request that this server could not understand.&lt;/p&gt;
  </code></pre>
  
  <p>Request from a simple POST web form:</p>
  
  <pre><code>POST /api/candidate HTTP/1.1
  Host: localhost:5000
  Content-Length: 33
  Cache-Control: max-age=0
  Origin: null
  Upgrade-Insecure-Requests: 1
  User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.95 Safari/537.36
  Content-Type: application/x-www-form-urlencoded
  Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
  Accept-Encoding: gzip, deflate, br
  Accept-Language: en-US,en;q=0.8
  
  first_name=Mickey&amp;last_name=Mouse
  </code></pre>
  
  <p>Return (correct):</p>
  
  <pre><code>{
      "id": "a7c2f6a3-e8d2-4c53-be97-ccf72a04295d",
      "url": "/api/candidate/a7c2f6a3-e8d2-4c53-be97-ccf72a04295d"
  }
  </code></pre>
  
  <p>Relevant python code:
  @app.route("/api/candidate", methods=["POST"])</p>
  
  <pre><code>def add_candidate():
      print dict(request.form)
      first_name = request.form["first_name"]
      last_name = request.form["last_name"]
      new_candidate_id = DATA_PROVIDER.add_candidate(first_name, last_name)
      return jsonify({
          "id": new_candidate_id,
          "url": url_for("candidate_by_id", id=new_candidate_id)
      })
  </code></pre>
  
  <p>Output of print when it fails:</p>
  
  <pre><code>{'------WebKitFormBoundary3Q45bnchdpXxtZbw\r\nContent-Disposition: form-data; name': [u'"first_name"\r\n\r\nSusan\r\n------WebKitFormBoundary3Q45bnchdpXxtZbw\r\nContent-Disposition: form-data; name="last_name"\r\n\r\nKruger\r\n------WebKitFormBoundary3Q45bnchdpXxtZbw--\r\n']}
  </code></pre>
  
  <p>Output of print when it works:</p>
  
  <pre><code>{'first_name': [u'Mickey'], 'last_name': [u'Mouse']}
  </code></pre>