Skip to content

Commit 1b1a2eb

Browse files
committed
use the proper initializer for Locale in NSHTTPCookie
1 parent 28772e6 commit 1b1a2eb

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Foundation/NSHTTPCookie.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ open class HTTPCookie : NSObject {
259259
_expiresDate = date
260260
} else if let dateString = expiresProperty as? String {
261261
let formatter = DateFormatter()
262-
formatter.locale = Locale(localeIdentifier: "en_US_POSIX")
262+
formatter.locale = Locale(identifier: "en_US_POSIX")
263263
formatter.dateFormat = "EEE, dd MMM yyyy HH:mm:ss O" // per RFC 6265 '<rfc1123-date, defined in [RFC2616], Section 3.3.1>'
264264
let timeZone = TimeZone(abbreviation: "GMT")
265265
formatter.timeZone = timeZone

TestFoundation/TestNSHTTPCookie.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ class TestNSHTTPCookie: XCTestCase {
156156
let cookies = HTTPCookie.cookies(withResponseHeaderFields: header, forURL: URL(string: "http://example.com")!)
157157
XCTAssertEqual(cookies[0].domain, "http://example.com")
158158
let formatter = DateFormatter()
159-
formatter.locale = Locale(localeIdentifier: "en_US_POSIX")
159+
formatter.locale = Locale(identifier: "en_US_POSIX")
160160
formatter.dateFormat = "EEE, dd MMM yyyy HH:mm:ss O"
161161
formatter.timeZone = TimeZone(abbreviation: "GMT")
162162
if let expiresDate = formatter.date(from: "Wed, 21 Sep 2016 05:33:00 GMT") {

0 commit comments

Comments
 (0)