1

I just switched from ASIHTTPRequest to MKNetworkKit, anyway I'm facing the following issue, the post request have this kind of url https://username:pass@hostname.com, when I make the request using MKNetworkKit I always receive a 403 error. below the code I use :

sharedEngine = [[super alloc] initWithHostName:@"hostname.com"]

MKNetworkOperation *op = [self operationWithPath:@"login.json"
                                          params:nil
                                      httpMethod:@"POST"
                                             ssl:YES];
[op setUsername:@"username" password:@"password" basicAuth:YES];
[op addData:[email dataUsingEncoding:NSUTF8StringEncoding] forKey:@"email"];
[op addData:[password dataUsingEncoding:NSUTF8StringEncoding] forKey:@"password"];

[op addCompletionHandler:^(MKNetworkOperation *completedOperation) {
    NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:completedOperation.responseData
                                                                       options:kNilOptions
                                                                         error:nil];
    handler(responseDictionary,completedOperation.HTTPStatusCode);

} errorHandler:^(MKNetworkOperation *completedOperation, NSError *error) {
    _error(error);
}];
[self enqueueOperation:op];

I don't understand what's wrong

4

0 回答 0