Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
URL-encode dates using unix timestamp (vapor#2276)
* Added ability to configure date coding/decoding for UrlEncodedForm * Added documentation to the `DateFormat` enum * renamed internetDateTime to iso8601 * Added custom date formatter * Added comment about `ISO8601DateFormatter` performance * Added ISO8601DateFormatter.threadSpecific so a new ISO8601DateFormatter isn't created for every encode/decode. * Use typealias instead of declaring DateFormat 2x * Added `ThreadSpecificDateFormatter` to ensure thread safety when using a `custom` DateFormat for `URLEncodedFormEncoder` or `URLEncodedFormDecoder` * Fixed comment * Changed custom interface to mimic `JSONDecoder.DateDecodingStrategy.custom(_:)` and `JSONEncoder.DateEncodingStrategy.custom(_:)` interfaces * Removed unused ThreadSpecificDateFormatter * `ISO8601DateFormatter` seems to be thread safe. This bug was filed: https://bugs.swift.org/browse/SR-7745?page=com.atlassian.jira.plugin.system.issuetabpanels%3Aall-tabpanel I tried running the sample program with `10000000` iterations in the `vapor/swift:5.2` docker image without any issue. * Default the date format for URLEncodedFrom coding/decoding to `timeIntervalSinceReferenceDate` * Default to `timeIntervalSince1970` * Removed all references to customizing DateFormat and default to `timeIntervalSince1970` * Removed reference to `import NIO` and fixed spacing * Fixed spacing * Implemented using `extension Date: URLQueryFragmentConvertible` * Spacing
- Loading branch information