Open
Description
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
Metadata
Metadata
Assignees
Labels
No labels