Skip to content
This repository was archived by the owner on Sep 26, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ios/Plugin/HttpRequestHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion ios/Plugin/Plugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down