title: AFNetworking Bad URL
body: <p>I'm having an odd issue here, and surprised I haven't found anyone else with the same problem. </p>
  
  <p>I'm using <code>AFNetworking</code> to make a <code>AFJSONRequestOperation</code>. </p>
  
  <p>It works the first time a network connection is made. However, the same code fails once a network connection is made and displays a 'Bad URL' error. </p>
  
  <p>The weird part is, the app never even pings the server before failing, I'm using Charles to sniff all requests.</p>
  
  <p>Has anyone else experienced this?  </p>
  
  <p>For reference, here is the code:</p>
  
  <pre><code>  NSURL *url = [NSURL URLWithString:JOIN_URL];
       AFHTTPClient *httpClient = [[AFHTTPClient alloc] initWithBaseURL:url];
  
     // httpClient.parameterEncoding = AFJSONParameterEncoding;
       NSString *path = [NSString stringWithFormat:@"%@?%@",JOIN_URL, getString];
  
       NSMutableURLRequest *request = [httpClient requestWithMethod:@"GET" path:path parameters:nil];
  
  
      AFJSONRequestOperation *operation = [AFJSONRequestOperation JSONRequestOperationWithRequest:request
  
                                                                                        success:^(NSURLRequest *request, NSHTTPURLResponse *response, id JSON) {
  
                                                                                            NSLog(@"SUCCESS JSON: %@", JSON);
  
                  NSLog(@"RESPONSE URL: %@",response.URL);
      } failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error, id JSON) {
          NSLog(@"FAIL JSON: %@", JSON);
          NSLog(@"FAIL ERROR: %@", error.description);
          NSLog(@"RESPONSE URL: %@",response.URL);
  
          UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Connection Error" message:@"Cannot connect now, please try again" delegate:nil cancelButtonTitle:@"Okay" otherButtonTitles: nil];
          [alert show];
  
      }];
  
  
      [operation start];
  </code></pre>