Skip to content

Commit b07f7b2

Browse files
committed
Fix cookies for other names
1 parent 1d5293d commit b07f7b2

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

templates/swift/Sources/Extensions/HTTPClientRequest+Cookies.swift.twig

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,12 @@ extension HTTPHeaders {
1515
let cookies: [HTTPClient.Cookie?]? = try? cookieJson?.fromJson(to: [HTTPClient.Cookie].self)
1616
?? [(try? cookieJson?.fromJson(to: HTTPClient.Cookie.self))]
1717

18-
if let authCookie = cookies?.first(where: { $0?.name.starts(with: "a_session_") == true } ) {
19-
add(name: "cookie", value: "\(authCookie!.name)=\(authCookie!.value)")
18+
var cookiesValue = ""
19+
for cookie in cookies ?? [] {
20+
if let cookie = cookie {
21+
cookiesValue += "\(cookie.name)=\(cookie.value);"
22+
}
2023
}
21-
}
24+
add(name: "Cookie", value: cookiesValue)
25+
}
2226
}

0 commit comments

Comments
 (0)