mirror of
https://github.com/apple/swift-http-structured-headers
synced 2026-11-24 04:37:50 +00:00
Add support for Date type to StructuredFieldValues (#49)
Motivation: The parser and serializer for the Date type has been implemented. The high-level encoder and decoder should follow. Modifications: - Implement the encoder and decoder for Date. Result: The StructuredFieldValues module will support the Date type.
This commit is contained in:
1 parent
c2e79ce44c
commit
6e527aa16a
12 files changed
+222
No files matched your search
@@ -72,6 +72,9 @@ extension TopLevelListDecoder: UnkeyedDecodingContainer {
|
||||
} else if type is Decimal.Type {
|
||||
let container = try self.decoder.singleValueContainer()
|
||||
return try container.decode(Decimal.self) as! T
|
||||
} else if type is Date.Type {
|
||||
let container = try self.decoder.singleValueContainer()
|
||||
return try container.decode(Date.self) as! T
|
||||
} else {
|
||||
return try type.init(from: self.decoder)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user