title: How download a authenticated file with a POST + params in AFNetworking 2?
body: <p>I need to download files that are authenticated. I have this in the python side:</p>
  
  <pre><code>@api_view(['POST'])
  @permission_classes((IsAuthenticated,))
  def downloadData(request):
      schema = request.user.company.username
      db = dbSync(schema)
  
      filePath = db.dbPath()
  
      tables = [(db.getTable('location'), 0)]
  
      if db.copyTables(filePath, tables):
          wrapper = FileWrapper(file(filePath))
          response = HttpResponse(wrapper, content_type='application/x-sqlite3')
          response['Content-Length'] = os.path.getsize(filePath)
          response['Content-Disposition'] = 'attachment; filename="tables.db"'
          response['Content-Transfer-Encoding'] = 'binary'
      else:
          response = HttpResponseNotModified()
  
      return response
  </code></pre>
  
  <p>This work fine when use the python request library / browser.</p>
  
  <p>Then I have this in iOS:</p>
  
  <pre><code>[self.session POST:@"sync/tables/" parameters:tables
             success:^(NSURLSessionDataTask *task, id responseObject) {
                 DDLogInfo(@"%@", responseObject);
                 handler(nil);
             }
             failure:^(NSURLSessionDataTask *task, NSError *error) {
                 DDLogCError(@"%@",error);
  
                handler(error);
             }];
  </code></pre>
  
  <p>The request pass, but the responseObject is <code>nil</code>.</p>
  
  <p>So I try with:</p>
  
  <pre><code>NSURL *URL = [NSURL URLWithString:@"http://localhost:8000/sync/tables/"];
      NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:URL];
  
      [request setValue:self.token forHTTPHeaderField:@"AUTHORIZATION"];
      [request setHTTPMethod:@"POST"];
  
      NSMutableString *params = [NSMutableString string];
  
      [tables enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
          [params appendFormat:@"%@=%@", key, obj];
      }];
  
      [request setHTTPBody:[params dataUsingEncoding:NSUTF8StringEncoding]];
  
      NSURLSessionDownloadTask *downloadTask = [self.session downloadTaskWithRequest:request progress:nil destination:^NSURL *(NSURL *targetPath, NSURLResponse *response) {
  
          NSString *path = [NSTemporaryDirectory() stringByAppendingPathComponent:@"temp.db"];
  
          return [NSURL fileURLWithPath:path];
      } completionHandler:^(NSURLResponse *response, NSURL *filePath, NSError *error) {
          DDLogInfo(@"File downloaded to: %@", filePath);
  
          if (error) {
              DDLogError(@"%@", error);
          }
          handler(error);
      }];
      [downloadTask resume];
  </code></pre>
  
  <p>This is a lot of repetition. So:</p>
  
  <p>1) Is possible to use NSURLSessionDownloadTask and be able to send the params as with <code>self.session POST</code>?</p>
  
  <p>2) Or <code>self.session POST</code> and get the file?</p>