Open
Description
Previous ID | SR-3821 |
Radar | None |
Original Reporter | ugultopu (JIRA User) |
Type | Bug |
Environment
Swift Version: Apple Swift version 3.0.2 (swiftlang-800.0.63 clang-800.0.42.1)
Additional Detail from JIRA
Votes | 0 |
Component/s | Foundation |
Labels | Bug, Documentation |
Assignee | None |
Priority | Medium |
md5: 81b51099634947e2f359b4adb8e97483
Issue Description:
Without providing a value for `HTTPCookiePropertyKey.path`, it is not possible to create an `HTTPCookie`, even though the documentation states that this field is optional.
Relevant part of the documentation (in `Foundation -> NSHTTPCookie -> HTTPCookie`)
<tr>
<td>NSHTTPCookiePath</td>
<td>NSString</td>
<td>NO</td>
<td>Path for the cookie. Inferred from the value for
NSHTTPCookieOriginURL if not provided. Default is "/".</td>
</tr>
However, the following code did not create an HTTPCookie for me (it returned `nil`):
HTTPCookie(properties: [HTTPCookiePropertyKey.name: "name", HTTPCookiePropertyKey.value: "value", HTTPCookiePropertyKey.domain: "localhost"])
The following code worked:
HTTPCookie(properties: [HTTPCookiePropertyKey.name: "name", HTTPCookiePropertyKey.value: "value", HTTPCookiePropertyKey.domain: "localhost", HTTPCookiePropertyKey.path: "/"])