title: POST Request with AFNetworking 2.0 not working, but working in HTTP Request tester
body: <p>I've just started using the new <code>AFNetworking 2.0</code> API having used the previous versions for a while now. I'm trying to do a bog standard <code>http POST request</code>, but sadly I'm not doing too well. This is my current code:<br></p>
  
  <pre><code>AFHTTPRequestOperationManager *operationManager = [AFHTTPRequestOperationManager manager];
  
  NSDictionary *parameters = @{@"username" : self.usernameField.text,
                               @"password" : self.passwordField.text};
  
  [operationManager POST:@"https:URL GOES HERE" parameters:parameters success:^(AFHTTPRequestOperation *operation, id responseObject) {
      NSLog(@"JSON: %@", [responseObject description]);
  } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
      NSLog(@"Error: %@", error);
  }];
  </code></pre>
  
  <p>Now this returns a <code>JSON</code> of <code>(NULL)</code> and doesn't give me a status code like <code>404</code> or something (incidentally how do we attain the status code when using AFN 2.0?). However, when I try the information with a web app like <a href="http://apikitchen.com" rel="nofollow">apikitchen.com</a> which tests the <code>HTTP Post request</code> for me, it works when I put the username and password in the <code>param</code> field. So really my question is, why don't the <code>parameters</code> in the <code>AFN 2.0 parameter property</code> act in the same way as the <code>parameters</code> in the web app? And more generally why aren't the <code>post request parameters</code> working for me in <code>AFN 2.0</code>?</p>
  
  <p>Thanks for the help in advance,<BR>
  Mike</p>
  
  <p><strong>EDIT:</strong> I'm struggling with the implementation of the suggested fix. My Post method now looks like this, but It doesn't make sense to me right now.</p>
  
  <pre><code>AFHTTPRequestOperationManager *operationManager = [AFHTTPRequestOperationManager manager];
  NSDictionary *parameters = @{@"username" : self.usernameField.text,
                               @"password" : self.passwordField.text};
  
  operationManager.requestSerializer.queryStringSerializationWithBlock =
  ^NSString*(NSURLRequest *request,
             NSDictionary *parameters,
             NSError *__autoreleasing *error) {
      NSString* encodedParams = form_urlencode_HTTP5_Parameters(parameters);
      return encodedParams;
  };
  
  [operationManager POST:@"URL HERE" parameters:parameters success:^(AFHTTPRequestOperation *operation, id responseObject) {
      NSLog(@"JSON: %@", [responseObject description]);
  } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
      NSLog(@"Error: %@", error);
  }];
  </code></pre>