Skip to content

Commit

Permalink
Extend HTTPRequest
Browse files Browse the repository at this point in the history
  • Loading branch information
Alkenso committed Aug 29, 2024
1 parent c353426 commit 3416cce
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Sources/SpellbookHTTP/HTTPRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public struct HTTPRequest {
public var query: [QueryItem: String] = [:]
public var headers: [Header: String] = [:]
public var body: Body?
public var extended: ((inout URLRequest) throws -> Void)?

public init(urlString: String, method: Method) {
self.url = urlString
Expand Down Expand Up @@ -175,6 +176,8 @@ extension HTTPRequest {
urlRequest.setValue($0.value, forHTTPHeaderField: $0.key.rawValue)
}

try extended?(&urlRequest)

return urlRequest
}
}

0 comments on commit 3416cce

Please sign in to comment.