0

I'm using AFNetworking 2 to perform a simple post operation:

    [self.manager POST:@"person"
        parameters:(NSDictionary *)parameters
constructingBodyWithBlock:nil
           success:^(AFHTTPRequestOperation *operation, id responseObject) {
               if (success)
                   success(responseObject);
           } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
               if (failure)
                   failure(error);
           }];

Every time this runs, XCode's console says that I got "Request failed: forbidden (403)" as the response. If I run against the exact same url shown in the NSErrorFailingURLKey via curl, I immediately get back the results I'd expect from the POST operation.

I haven't enabled any type of authentication on the script being called. It's just a Restler class. Am I missing a step here?

Gargoyle
  • 9,590
  • 16
  • 80
  • 145
  • curl like so works: curl -X POST -H "Content-Type: application/json" -d '{"email":"foo@bar.com",....}' http://..../person – Gargoyle Jan 04 '14 at 05:04

1 Answers1

0

Adding the 'constructingBodyWithBlock' changed the type of message being sent. Had to remove that in order to make it work.

Gargoyle
  • 9,590
  • 16
  • 80
  • 145