我正在尝试使用以下格式发送 PUT 请求:
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];
但是参数会被放入请求的正文中,而不是像在 GET 或 DELETE 请求中那样放入 URL。POST 请求也是如此。
感谢您的任何建议。