title: AFNetworking POST gives no args or data, though GET works
body: <p>I want to post an image to a server-side Flask endpoint. I run the following GET and POST using the following code, and then I describe what the server receives. How can I make sure the server receives the image and post parameters in the POST request? </p>
  
  <pre><code>    [_client POST:@"post_image"
               parameters:parameters
               constructingBodyWithBlock:nil
               success:^(NSURLSessionDataTask *task, id responseObject) {
                   NSLog([responseObject description]);
               }
               failure:^(NSURLSessionDataTask *task, NSError *error) {
                   NSLog([error description]);
               }
       ];
  
     [_client GET:@"test_get"
       parameters:parameters
       success:^(NSURLSessionDataTask *task, id responseObject) {
           NSLog([responseObject description]);
       }
       failure:^(NSURLSessionDataTask *task, NSError *error) {
           NSLog([error description]);
       }
     ];
  </code></pre>
  
  <p>The logs print:</p>
  
  <pre><code>2014-07-02 10:29:06.883 lens-app[2808:60b] {
      code = "";
      data = "good stuff";
      error = "";
      success = 1;
  }
  2014-07-02 10:29:06.889 lens-app[2808:60b] {
      code = "";
      data = "good stuff";
      error = "";
      success = 1;
  }
  </code></pre>
  
  <p>I use this Flask code to describe the requests the server receives:</p>
  
  <pre><code>def print_request():
    print 'request'
    print str(request)
    print 'request.headers'
    print str(request.headers)
    print 'request.args'
    print str(request.args)
    print 'request.form'
    print str(request.form)
    print 'request.files'
    print str(request.files)
    print 'request.data'
    print str(request.data)
    print 'request.stream'
    print str(request.stream.read())
    print 'request.environ'
    print str(request.environ)
    print 'request.get_json()'
    print str(request.get_json())
    print 'row post body'
    print str(request.environ['body_copy'])
  
  @app.route('/post_image', methods=['POST'])
  def post_image():
    print_request()
    return json_response('good stuff')
  
  @app.route('/test_get', methods=['GET'])
  def test_get():
    print_request()
    return json_response('good stuff')
  </code></pre>
  
  <p>Here's the result of the post request:</p>
  
  <pre><code>request
  &lt;Request 'http://ec2-xyz.us-west-2.compute.amazonaws.com/post_image' [POST]&gt;
  request.headers
  Transfer-Encoding: Chunked
  Content-Length:
  User-Agent: lens-app/1.0 (iPhone; iOS 7.1.1; Scale/2.00)
  Connection: keep-alive
  Host: ec2-xyz.us-west-2.compute.amazonaws.com
  Accept: */*
  Accept-Language: en;q=1, fr;q=0.9, de;q=0.8, zh-Hans;q=0.7, zh-Hant;q=0.6, ja;q=0.5
  Content-Type: multipart/form-data; boundary=Boundary+F841C4764BD7CE95
  Accept-Encoding: gzip, deflate
  
  
  request.args
  ImmutableMultiDict([])
  request.form
  ImmutableMultiDict([])
  request.files
  ImmutableMultiDict([])
  request.data
  
  request.stream
  
  request.environ
  {'wsgi.multiprocess': False, 'SERVER_SOFTWARE': 'Werkzeug/0.9.6', 'SCRIPT_NAME': '', 'HTTP_TRANSFER_ENCODING': 'Chunked', 'REQUEST_METHOD': 'POST', 'PATH_INFO': '/post_image', 'SERVER_PROTOCOL': 'HTTP/1.1', 'QUERY_STRING': '', 'werkzeug.server.shutdown': &lt;function shutdown_server at 0x2c45c80&gt;, 'CONTENT_LENGTH': '', 'HTTP_USER_AGENT': 'lens-app/1.0 (iPhone; iOS 7.1.1; Scale/2.00)', 'HTTP_CONNECTION': 'keep-alive', 'SERVER_NAME': '0.0.0.0', 'REMOTE_PORT': 44640, 'wsgi.url_scheme': 'http', 'SERVER_PORT': '80', 'werkzeug.request': &lt;Request 'http://ec2-54-214-166-2.us-west-2.compute.amazonaws.com/post_image' [POST]&gt;, 'body_copy': '', 'wsgi.input': &lt;cStringIO.StringI object at 0x2be5ad0&gt;, 'HTTP_HOST': 'ec2-xyz.us-west-2.compute.amazonaws.com', 'wsgi.multithread': False, 'HTTP_ACCEPT': '*/*', 'wsgi.version': (1, 0), 'wsgi.run_once': False, 'wsgi.errors': &lt;open file '&lt;stderr&gt;', mode 'w' at 0x7fccfbd3f1e0&gt;, 'REMOTE_ADDR': '204.28.119.158', 'HTTP_ACCEPT_LANGUAGE': 'en;q=1, fr;q=0.9, de;q=0.8, zh-Hans;q=0.7, zh-Hant;q=0.6, ja;q=0.5', 'CONTENT_TYPE': 'multipart/form-data; boundary=Boundary+F841C4764BD7CE95', 'HTTP_ACCEPT_ENCODING': 'gzip, deflate'}
  request.get_json()
  None
  row post body
  </code></pre>
  
  <p>Here's the result of the get request:</p>
  
  <pre><code>request
  &lt;Request 'http://ec2-xyz.us-west-2.compute.amazonaws.com/test_get?up=what's&amp;you=Hey' [GET]&gt;
  request.headers
  Content-Length:
  User-Agent: lens-app/1.0 (iPhone; iOS 7.1.1; Scale/2.00)
  Connection: keep-alive
  Host: ec2-xyz.us-west-2.compute.amazonaws.com
  Accept: */*
  Accept-Language: en;q=1, fr;q=0.9, de;q=0.8, zh-Hans;q=0.7, zh-Hant;q=0.6, ja;q=0.5
  Content-Type:
  Accept-Encoding: gzip, deflate
  
  
  request.args
  ImmutableMultiDict([('you', u'Hey'), ('up', u"what's")])
  request.form
  ImmutableMultiDict([])
  request.files
  ImmutableMultiDict([])
  request.data
  
  request.stream
  
  request.environ
  {'wsgi.multiprocess': False, 'SERVER_SOFTWARE': 'Werkzeug/0.9.6', 'SCRIPT_NAME': '', 'REQUEST_METHOD': 'GET', 'PATH_INFO': '/test_get', 'SERVER_PROTOCOL': 'HTTP/1.1', 'QUERY_STRING': 'up=what%27s&amp;you=Hey', 'werkzeug.server.shutdown': &lt;function shutdown_server at 0x2c45c08&gt;, 'CONTENT_LENGTH': '', 'HTTP_USER_AGENT': 'lens-app/1.0 (iPhone; iOS 7.1.1; Scale/2.00)', 'HTTP_CONNECTION': 'keep-alive', 'SERVER_NAME': '0.0.0.0', 'REMOTE_PORT': 33553, 'wsgi.url_scheme': 'http', 'SERVER_PORT': '80', 'werkzeug.request': &lt;Request 'http://ec2-xyz.us-west-2.compute.amazonaws.com/test_get?up=what's&amp;you=Hey' [GET]&gt;, 'body_copy': '', 'wsgi.input': &lt;cStringIO.StringI object at 0x2be5ad0&gt;, 'HTTP_HOST': 'ec2-xyz.us-west-2.compute.amazonaws.com', 'wsgi.multithread': False, 'HTTP_ACCEPT': '*/*', 'wsgi.version': (1, 0), 'wsgi.run_once': False, 'wsgi.errors': &lt;open file '&lt;stderr&gt;', mode 'w' at 0x7fccfbd3f1e0&gt;, 'REMOTE_ADDR': '204.28.119.158', 'HTTP_ACCEPT_LANGUAGE': 'en;q=1, fr;q=0.9, de;q=0.8, zh-Hans;q=0.7, zh-Hant;q=0.6, ja;q=0.5', 'CONTENT_TYPE': '', 'HTTP_ACCEPT_ENCODING': 'gzip, deflate'}
  request.get_json()
  None
  row post body
  </code></pre>