Skip to content

Commit

Permalink
HeaderProvider is async (#152)
Browse files Browse the repository at this point in the history
  • Loading branch information
MadsBogeskov authored Dec 11, 2024
1 parent 6021d6f commit 82bb5a0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Sources/SwaggerSwiftCore/API Factory/APIFactory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ struct APIFactory {
if hasGlobalHeaders {
fields.append(APIDefinitionField(name: "headerProvider",
description: "a block provider for the set of globally defined headers",
typeName: "() -> any GlobalHeaders",
typeName: "() async -> any GlobalHeaders",
isRequired: true,
typeIsAutoclosure: false,
typeIsBlock: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ extension APIRequest {

var globalHeaders = [String]()
if swaggerFile.globalHeaders.count > 0 {
globalHeaders.append("let globalHeaders = self.headerProvider()")
globalHeaders.append("let globalHeaders = await self.headerProvider()")
globalHeaders.append("globalHeaders.add(to: &request)")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Foundation
public protocol APIInitialize {
init(urlSession: @escaping () -> URLSession,
baseUrlProvider: @escaping () -> URL,
headerProvider: @escaping () -> any GlobalHeaders,
headerProvider: @escaping () async -> any GlobalHeaders,
interceptor: (any NetworkInterceptor)?
)
}
Expand Down

0 comments on commit 82bb5a0

Please sign in to comment.