title: AFNetworking simple HTTP request
body: <p>I am using <a href="https://github.com/AFNetworking/AFNetworking" rel="nofollow">AFNetworking</a> in my project and I simply need to check if a URL is successful (status 2xx).</p>
  
  <p>I tried</p>
  
  <pre><code>NSURLRequest *request = [NSURLRequest requestWithURL:url2check];
  AFJSONRequestOperation *operation = [AFJSONRequestOperation
      JSONRequestOperationWithRequest:request
      success:^(NSURLRequest *request, NSHTTPURLResponse *response, id JSON) {
          if (response.status == 200) {
              NSLog(@"Ok %@", JSON);
          }
      }
      failure:nil
  ];
  [operation start];
  </code></pre>
  
  <p>But as I'm not awaiting JSON especially, I was expecting to use something like</p>
  
  <pre><code>AFHTTPRequestOperation *operation = [AFHTTPRequestOperation
      HTTPRequestOperationWithRequest: success: failure:];
  </code></pre>
  
  <p>But this does not exist (I don't know why), so I used</p>
  
  <pre><code>AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc]
      initWithRequest:request];
  [operation setCompletionBlockWithSuccess:...]
  </code></pre>
  
  <p>Isn't there simpler ?</p>
  
  <p>How would you do this simple URL check with AFNetworking ?</p>