title: AFNetworking Get full http response
body: <p>I am querying my server using <code>AFNetworking</code>, the latest - to date - version.</p>
  
  <p>My server side PHP is sending a PHP related error but I am unable to see what the error is ( so I can debug it) as  AFNetworking is expecting a JSON.</p>
  
  <p>Could anyone tell me how could I see the full HTTP result. I've researched and I know is something to do with <code>operation.responseString</code> inside the <code>success</code> / <code>fail</code> block  my current block does not have <code>AFHTTPRequestOperation* operation</code> and I can't add it as another block variable somehow.</p>
  
  <p>I would really appreciate some help.</p>
  
  <p>The following code uses </p>
  
  <pre><code>NSURL *url = [[NSURL alloc]initWithString:URL];
      AFHTTPClient *httpClient = [[AFHTTPClient alloc]initWithBaseURL:url];
  
  
      NSURLRequest *request = [httpClient multipartFormRequestWithMethod:@"POST" path:URLPATH parameters:params constructingBodyWithBlock:^(id&lt;AFMultipartFormData&gt; formData)
                               {
                                   //...
                                   }
  
  AFJSONRequestOperation *operation = [AFJSONRequestOperation JSONRequestOperationWithRequest:request
                                                                                          success:^(NSURLRequest *request, NSHTTPURLResponse *response, id JSON){
                                                                                              NSLog(@"Inside the success block %@",JSON);
                                                                                              [[self delegate ]shareExerciseDone:JSON];
                                                                                              [[self delegate] activityIndicatorFinish];
  
                                                                                          }
                                                                                          failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error, id JSON){
  
                                                                                              NSLog(@"Response text is: %@", operation.responseString);
                                                                                              NSLog(@"json text is: %@", JSON);
                                                                                              NSLog(@"Request failed with error: %@, %@", error, error.userInfo);
  
                                                                                              [[self delegate] activityIndicatorFinish];
                                                                                          }];
  
      [operation start];
  </code></pre>
  
  <p><strong>The error</strong></p>
  
  <pre><code>Request failed with error: Error Domain=NSCocoaErrorDomain Code=3840 "The operation couldn’t be completed. (Cocoa error 3840.)" (JSON text did not start with array or object and option to allow fragments not set.) UserInfo=0xc1b4520 {NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set.}, {
      NSDebugDescription = "JSON text did not start with array or object and option to allow fragments not set.";
  </code></pre>