From 9396d017c0aa465f18322b3584ecb165c5b22afa Mon Sep 17 00:00:00 2001 From: Jozef Izso Date: Sun, 5 Aug 2012 01:13:23 +0200 Subject: [PATCH] Fixed POST method in LRRestyResource to issue POST instead of PUT. Created separate PUT method. --- Classes/LRRestyResource.h | 1 + Classes/LRRestyResource.m | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Classes/LRRestyResource.h b/Classes/LRRestyResource.h index 9d5e27b..22e303f 100644 --- a/Classes/LRRestyResource.h +++ b/Classes/LRRestyResource.h @@ -32,6 +32,7 @@ typedef void (^LRRestyResourceResponseBlock)(LRRestyResponse *response, LRRestyR - (LRRestyRequest *)get:(LRRestyResourceResponseBlock)responseBlock; - (void)post:(LRRestyResourceResponseBlock)responseBlock; - (void)post:(id)payload callback:(LRRestyResourceResponseBlock)responseBlock; +-(void)put:(id)payload callback:(LRRestyResourceResponseBlock)responseBlock; @end @interface LRRestyResource (Streaming) diff --git a/Classes/LRRestyResource.m b/Classes/LRRestyResource.m index 1c98415..af4524c 100644 --- a/Classes/LRRestyResource.m +++ b/Classes/LRRestyResource.m @@ -133,12 +133,21 @@ - (void)post:(LRRestyResourceResponseBlock)responseBlock; - (void)post:(id)payload callback:(LRRestyResourceResponseBlock)responseBlock; { __block LRRestyResource *blockResource = [self retain]; - [restClient put:[URL absoluteString] payload:payload headers:nil withBlock:^(LRRestyResponse *response){ + [restClient post:[URL absoluteString] payload:payload headers:nil withBlock:^(LRRestyResponse *response){ responseBlock(response, blockResource); [blockResource release]; }]; } +- (void)put:(id)payload callback:(LRRestyResourceResponseBlock)responseBlock; +{ + __block LRRestyResource *blockResource = [self retain]; + [restClient put:[URL absoluteString] payload:payload headers:nil withBlock:^(LRRestyResponse *response){ + responseBlock(response, blockResource); + [blockResource release]; + }]; +} + // forward other methods to the client - (id)forwardingTargetForSelector:(SEL)aSelector