mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2024-12-20 06:30:31 +01:00
Make HTTPConditionalGetInfo serialize and deserialize to a plist.
This commit is contained in:
parent
f17f31ba12
commit
a336140a9a
@ -18,6 +18,22 @@ public struct HTTPConditionalGetInfo {
|
||||
}
|
||||
}
|
||||
|
||||
public var plist: [String: String]? {
|
||||
get {
|
||||
if isEmpty {
|
||||
return nil
|
||||
}
|
||||
var d = [String: String]()
|
||||
if let lastModified = lastModified {
|
||||
d[HTTPResponseHeader.lastModified] = lastModified
|
||||
}
|
||||
if let etag = etag {
|
||||
d[HTTPResponseHeader.etag] = etag
|
||||
}
|
||||
return d
|
||||
}
|
||||
}
|
||||
|
||||
public init(lastModified: String?, etag: String?) {
|
||||
|
||||
self.lastModified = lastModified
|
||||
@ -31,6 +47,11 @@ public struct HTTPConditionalGetInfo {
|
||||
|
||||
self.init(lastModified: lastModified, etag: etag)
|
||||
}
|
||||
|
||||
public init(plist: [String: String]) {
|
||||
|
||||
self.init(lastModified: plist[HTTPResponseHeader.lastModified], etag: plist[HTTPResponseHeader.etag])
|
||||
}
|
||||
|
||||
public func addRequestHeadersToURLRequest(_ urlRequest: NSMutableURLRequest) {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user