You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This code works on macOS but produces nil on Linux.
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif
let url = "https://dummy.com/"
let cookie = HTTPCookie(properties: [.name: "cookieName", .value: "cookieValue", .path: "/", .originURL: url])
//cookie == nil here on Linux
The root cause is that HTTPCookie(properties:) happily accepts a String for .originURL with Foundation but only accepts an URL with FoundationNetworking.
This code works both on macOS and Linux
let url = URL(string: "https://dummy.com/")!
let cookie = HTTPCookie(properties: [.name: "cookieName", .value: "cookieValue", .path: "/", .originURL: url])
//cookie != nil here on Linux and macOS
According to @Lukasa, this is probably a compatibility bug
The text was updated successfully, but these errors were encountered:
This code works on macOS but produces
nil
on Linux.The root cause is that
HTTPCookie(properties:)
happily accepts aString
for.originURL
with Foundation but only accepts anURL
with FoundationNetworking.This code works both on macOS and Linux
According to @Lukasa, this is probably a compatibility bug
The text was updated successfully, but these errors were encountered: