Skip to content

Commit

Permalink
Fix after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
grdsdev committed Oct 17, 2023
1 parent 1a4d03a commit 9b5bf67
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Sources/Functions/FunctionsClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public actor FunctionsClient {
let url = self.url.appendingPathComponent(functionName)
var urlRequest = URLRequest(url: url)
urlRequest.allHTTPHeaderFields = invokeOptions.headers.merging(headers) { first, _ in first }
urlRequest.httpMethod = invokeOptions.method?.rawValue ?? "POST
urlRequest.httpMethod = (invokeOptions.method ?? .post).rawValue
urlRequest.httpBody = invokeOptions.body

let (data, response) = try await fetch(urlRequest)
Expand Down
8 changes: 6 additions & 2 deletions Sources/Functions/Types.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,17 @@ public enum FunctionsError: Error, LocalizedError {

/// Options for invoking a function.
public struct FunctionInvokeOptions {
/// Method to use in the function invocation.
let method: Method?
/// Headers to be included in the function invocation.
let headers: [String: String]
/// Body data to be sent with the function invocation.
let body: Data?

/// Initializes the `FunctionInvokeOptions` structure.
///
///
/// - Parameters:
/// - method: Method to use in the function invocation.
/// - headers: Headers to be included in the function invocation. (Default: empty dictionary)
/// - body: The body data to be sent with the function invocation. (Default: nil)
public init(method: Method? = nil, headers: [String: String] = [:], body: some Encodable) {
Expand All @@ -53,7 +55,9 @@ public struct FunctionInvokeOptions {

/// Initializes the `FunctionInvokeOptions` structure.
///
/// - Parameter headers: Headers to be included in the function invocation. (Default: empty dictionary)
/// - Parameters:
/// - method: Method to use in the function invocation.
/// - headers: Headers to be included in the function invocation. (Default: empty dictionary)
public init(method: Method? = nil, headers: [String: String] = [:]) {
self.method = method
self.headers = headers
Expand Down

0 comments on commit 9b5bf67

Please sign in to comment.