Skip to content

Commit 23d2f3b

Browse files
vipinmenonparkera
authored andcommitted
Implementation of Description string for NSHTTPCookie (#685)
1 parent b62933f commit 23d2f3b

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

Foundation/NSHTTPCookie.swift

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,30 @@ open class HTTPCookie : NSObject {
593593
open var portList: [NSNumber]? {
594594
return _portList
595595
}
596+
597+
open override var description: String {
598+
var str = "<\(type(of: self)) "
599+
str += "version:\(self._version) name:\"\(self._name)\" value:\"\(self._value)\" expiresDate:"
600+
if let expires = self._expiresDate {
601+
str += "\(expires)"
602+
} else {
603+
str += "nil"
604+
}
605+
str += " sessionOnly:\(self._sessionOnly) domain:\"\(self._domain)\" path:\"\(self._path)\" isSecure:\(self._secure) comment:"
606+
if let comments = self._comment {
607+
str += "\(comments)"
608+
} else {
609+
str += "nil"
610+
}
611+
str += " ports:{ "
612+
if let ports = self._portList {
613+
str += "\(NSArray(array: (ports)).componentsJoined(by: ","))"
614+
} else {
615+
str += "0"
616+
}
617+
str += " }>"
618+
return str
619+
}
596620
}
597621

598622
//utils for cookie parsing

0 commit comments

Comments
 (0)