0
我試圖發送帶有此格式的PUT請求:添加網址參數,以RestKit RKObjectManager putObject
http://server.com/api/tag/:tagId?extra1=abc&extra2=def
RKObjectManager *manager = [RKObjectManager managerWithBaseURL:@"http://server.com"];
[manager.router.routeSet addRoute:[RKRoute routeWithClass:[Tag class] pathPattern:@"/api/tag/:tagId" method:RKRequestMethodPut]];
Tag *tag = [[Tag alloc] initWithName:name andId:tagId];
[manager putObject:tag path:nil parameters:@{@"extra1":@"abc", @"extra2":@"def"}
success:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult) {
[delegate onRequestSuccess:request withData:tag];
}
failure:^(RKObjectRequestOperation *operation, NSError *error) {
}];
[delegate onRequestStart:request];
但得到的參數放入請求的主體,而不是URL的正如它在GET或DELETE請求中所做的一樣。 POST請求也會發生同樣的情況。
感謝您的任何建議。