Skip to content

Commit 8110127

Browse files
committed
Fix header parsing
1 parent 1b80c9d commit 8110127

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Tool/Sources/OpenAIService/HeaderValueParser.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public struct HeaderValueParser {
1515
public var apiKey: String
1616
public var gitHubCopilotToken: () async -> GitHubCopilotExtension.Token?
1717
public var shellEnvironmentVariable: (_ key: String) async -> String?
18-
18+
1919
public init(
2020
modelName: String,
2121
apiKey: String,
@@ -66,7 +66,10 @@ public struct HeaderValueParser {
6666
}
6767

6868
if let replacement {
69-
parsedValue.replaceSubrange(range, with: replacement)
69+
parsedValue.replaceSubrange(
70+
range,
71+
with: replacement.trimmingCharacters(in: .whitespacesAndNewlines)
72+
)
7073
} else {
7174
parsedValue.replaceSubrange(range, with: "none")
7275
}

0 commit comments

Comments
 (0)