Add optional pkginfo to middleware requests to match existing Python implementation

This commit is contained in:
Greg Neagle
2025-05-20 13:37:37 -07:00
parent 760780493e
commit 4e310609f6
3 changed files with 6 additions and 5 deletions
+5 -4
View File
@@ -184,13 +184,14 @@ func getURL(
if pathExists(tempDownloadPath), !resume {
try? FileManager.default.removeItem(atPath: tempDownloadPath)
}
let headers = headerDictFromList(customHeaders)
// Run middleware
var request = MunkiMiddlewareRequest(
url: url,
headers: headers
headers: headers,
pkginfo: pkginfo
)
request = runMiddleware(request)
@@ -205,7 +206,7 @@ func getURL(
let ignoreSystemProxy = pref("IgnoreSystemProxies") as? Bool ?? false
var options = GurlOptions(
let options = GurlOptions(
url: request.url,
destinationPath: tempDownloadPath,
additionalHeaders: request.headers,
@@ -66,4 +66,3 @@ func loadMiddlewarePlugin() throws -> MunkiMiddleware? {
}
return nil
}
@@ -23,6 +23,7 @@ import Foundation
public struct MunkiMiddlewareRequest {
var url: String
var headers: [String: String]
var pkginfo: PlistDict?
}
public protocol MunkiMiddleware {