From e18f9eee51f1d1f2c7836c8c0d1bba54a6f2c577 Mon Sep 17 00:00:00 2001 From: Sefa Ilkimen Date: Mon, 27 Jan 2020 02:22:29 +0100 Subject: [PATCH] implement feat #155 for iOS --- src/ios/CordovaHttpPlugin.h | 4 +++- src/ios/CordovaHttpPlugin.m | 24 ++++++++++++++---------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/ios/CordovaHttpPlugin.h b/src/ios/CordovaHttpPlugin.h index e87a1de..3b35e17 100644 --- a/src/ios/CordovaHttpPlugin.h +++ b/src/ios/CordovaHttpPlugin.h @@ -6,10 +6,12 @@ - (void)setServerTrustMode:(CDVInvokedUrlCommand*)command; - (void)post:(CDVInvokedUrlCommand*)command; -- (void)get:(CDVInvokedUrlCommand*)command; - (void)put:(CDVInvokedUrlCommand*)command; - (void)patch:(CDVInvokedUrlCommand*)command; +- (void)get:(CDVInvokedUrlCommand*)command; - (void)delete:(CDVInvokedUrlCommand*)command; +- (void)head:(CDVInvokedUrlCommand*)command; +- (void)options:(CDVInvokedUrlCommand*)command; - (void)uploadFiles:(CDVInvokedUrlCommand*)command; - (void)downloadFile:(CDVInvokedUrlCommand*)command; diff --git a/src/ios/CordovaHttpPlugin.m b/src/ios/CordovaHttpPlugin.m index df31126..ac559c6 100644 --- a/src/ios/CordovaHttpPlugin.m +++ b/src/ios/CordovaHttpPlugin.m @@ -302,6 +302,18 @@ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; } +- (void)post:(CDVInvokedUrlCommand*)command { + [self executeRequestWithData: command withMethod:@"POST"]; +} + +- (void)put:(CDVInvokedUrlCommand*)command { + [self executeRequestWithData: command withMethod:@"PUT"]; +} + +- (void)patch:(CDVInvokedUrlCommand*)command { + [self executeRequestWithData: command withMethod:@"PATCH"]; +} + - (void)get:(CDVInvokedUrlCommand*)command { [self executeRequestWithoutData: command withMethod:@"GET"]; } @@ -314,16 +326,8 @@ [self executeRequestWithoutData: command withMethod:@"HEAD"]; } -- (void)post:(CDVInvokedUrlCommand*)command { - [self executeRequestWithData: command withMethod:@"POST"]; -} - -- (void)put:(CDVInvokedUrlCommand*)command { - [self executeRequestWithData: command withMethod:@"PUT"]; -} - -- (void)patch:(CDVInvokedUrlCommand*)command { - [self executeRequestWithData: command withMethod:@"PATCH"]; +- (void)options:(CDVInvokedUrlCommand*)command { + [self executeRequestWithoutData: command withMethod:@"OPTIONS"]; } - (void)uploadFiles:(CDVInvokedUrlCommand*)command {