fix: set header date formatter options

This commit is contained in:
CMK 2021-01-27 19:24:31 +08:00
parent 27a7ccbd88
commit 00fb8eb175
4 changed files with 20 additions and 8 deletions

View File

@ -91,9 +91,3 @@ extension Mastodon.API.Timeline {
} }
} }
} }
extension Bool {
var queryItemValue: String {
return self ? "true" : "false"
}
}

View File

@ -11,7 +11,11 @@ import enum NIOHTTP1.HTTPResponseStatus
extension Mastodon.API { extension Mastodon.API {
static let timeoutInterval: TimeInterval = 10 static let timeoutInterval: TimeInterval = 10
static let httpHeaderDateFormatter = ISO8601DateFormatter() static let httpHeaderDateFormatter: ISO8601DateFormatter = {
var formatter = ISO8601DateFormatter()
formatter.formatOptions.insert(.withFractionalSeconds)
return formatter
}()
static let encoder: JSONEncoder = { static let encoder: JSONEncoder = {
let encoder = JSONEncoder() let encoder = JSONEncoder()
encoder.dateEncodingStrategy = .iso8601 encoder.dateEncodingStrategy = .iso8601

View File

@ -18,7 +18,7 @@ extension Mastodon.Entity {
public let content: String public let content: String
public let account: User public let account: User
public let language: String public let language: String?
public let visibility: String public let visibility: String
enum CodingKeys: String, CodingKey { enum CodingKeys: String, CodingKey {

View File

@ -0,0 +1,14 @@
//
// Bool.swift
//
//
// Created by MainasuK Cirno on 2021/1/27.
//
import Foundation
extension Bool {
var queryItemValue: String {
return self ? "true" : "false"
}
}