Skip to content
This repository has been archived by the owner on Sep 26, 2022. It is now read-only.

Commit

Permalink
fix(iOS): pass http method to request functions on ios (#152)
Browse files Browse the repository at this point in the history
  • Loading branch information
joeflateau authored Jul 27, 2021
1 parent e257bd1 commit 232409e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
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

0 comments on commit 232409e

Please sign in to comment.