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
@@ -117,6 +117,9 @@ extension StructuredFieldValueDecoder {
|
||||
} else if type is Decimal.Type {
|
||||
let container = try decoder.singleValueContainer()
|
||||
return try container.decode(Decimal.self) as! StructuredField
|
||||
} else if type is Date.Type {
|
||||
let container = try decoder.singleValueContainer()
|
||||
return try container.decode(Date.self) as! StructuredField
|
||||
} else {
|
||||
return try type.init(from: decoder)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user