title: AFNetworking version 2 content-type error
body: <p>I'm attempting to make an iphone app that will interact with a particular JIRA server.  I've got the following code to log in:</p>
  
  <pre><code>NSURL *url = [[NSURL alloc] initWithString:@"https://mycompany.atlassian.net/rest/auth/latest/session/"];
  NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
  [request setHTTPMethod:@"POST"];
  NSString *postString = [NSString stringWithFormat:@"{\"username\":\"%@\",\"password\":\"%@\"}", username, password];
  [request setHTTPBody:[postString dataUsingEncoding:NSUTF8StringEncoding]];
  AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];
  [request setValue:@"application/json" forHTTPHeaderField:@"Accept" ];
  operation.responseSerializer = [AFJSONResponseSerializer serializer];
  [operation setCompletionBlockWithSuccess:
      ^(AFHTTPRequestOperation *operation, id responseObject) {
          NSLog(@"JSON: %@", responseObject);
      } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
      NSLog(@"ERROR: %@", error);
  
      }
   ];
   [operation start];
  </code></pre>
  
  <p>But it's giving me the following error having to do with Content-Type:</p>
  
  <pre><code>ERROR: Error Domain=AFNetworkingErrorDomain Code=-1011
  "Request failed: unsupported media type (415)"
  UserInfo=0x8cd6540
  {
    NSErrorFailingURLKey=https://mycompany.atlassian.net/rest/auth/latest/session/,
    NSLocalizedDescription=Request failed: unsupported media type (415),
    NSUnderlyingError=0x8c72e70
    "Request failed: unacceptable content-type: text/html", 
  </code></pre>
  
  <p>I'm not sure what the problem is.  I found <b><a href="https://stackoverflow.com/questions/17648090/afnetworking-expected-content-type-error">this question</a></b>, which I thought might be a similar problem, but the answers say to either use the <code>AFJSONRequestOperation</code> class (which I can't because I'm using AFNetworking version 2, which doesn't have that class), or to fix it on the server side (which I also can't for obvious reasons).</p>
  
  <p>What can I fix this error when I can't fix the server side and I can't use <code>AFJSONRequestOperation</code>?</p>