diff --git a/ios/Plugin/HttpRequestHandler.swift b/ios/Plugin/HttpRequestHandler.swift index 0c7b3986..f2a6e068 100644 --- a/ios/Plugin/HttpRequestHandler.swift +++ b/ios/Plugin/HttpRequestHandler.swift @@ -150,9 +150,9 @@ class HttpRequestHandler { } - public static func request(_ call: CAPPluginCall) throws { + public static func request(_ call: CAPPluginCall, _ httpMethod: String?) throws { guard let urlString = call.getString("url") else { throw URLError(.badURL) } - guard let method = call.getString("method") else { throw URLError(.dataNotAllowed) } + guard let method = httpMethod ?? call.getString("method") else { throw URLError(.dataNotAllowed) } let headers = (call.getObject("headers") ?? [:]) as! [String: String] let params = (call.getObject("params") ?? [:]) as! [String: Any] diff --git a/ios/Plugin/Plugin.swift b/ios/Plugin/Plugin.swift index e6dbd04f..f4f4f6f3 100644 --- a/ios/Plugin/Plugin.swift +++ b/ios/Plugin/Plugin.swift @@ -27,7 +27,7 @@ import Foundation guard var _ = URL(string: u) else { return call.reject("Invalid URL"); } do { - try HttpRequestHandler.request(call) + try HttpRequestHandler.request(call, httpMethod) } catch let e { call.reject(e.localizedDescription) }