You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
my post route
router.post("/addpage") { request, response, _ in
let page = try request.read(as: Page.self)
...
my struct is
struct Page: Codable, QueryParameter {
var id: Int
var title: String
var body: String
var date: Date
}
the error I receive is
[2019-12-10T10:38:49.491+01:00] [VERBOSE] [QueryDecoder.swift:128 decode(_:)] fieldName: id, fieldValue: Optional("0")
[2019-12-10T10:38:49.491+01:00] [VERBOSE] [QueryDecoder.swift:128 decode(_:)] fieldName: title, fieldValue: Optional("eee")
[2019-12-10T10:38:49.491+01:00] [VERBOSE] [QueryDecoder.swift:128 decode(_:)] fieldName: body, fieldValue: Optional("ee")
[2019-12-10T10:38:49.491+01:00] [VERBOSE] [QueryDecoder.swift:128 decode(_:)] fieldName: date, fieldValue: Optional("2019-12-10")
[2019-12-10T10:38:49.492+01:00] [ERROR] [QueryDecoder.swift:332 decodingError()] Could not process field named 'date'.
[2019-12-10T10:38:49.493+01:00] [ERROR] [RouterMiddlewareWalker.swift:72 next()] dataCorrupted(Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "date", intValue: nil)], debugDescription: "Could not process field named \'date\'.", underlyingError
I assume is because the format of date is wrong (but I see no other way to get the date to the add form template ? but also if date is null it still throws an error.
The text was updated successfully, but these errors were encountered:
I have a form
and the relevant form
my struct is
the error I receive is
I assume is because the format of date is wrong (but I see no other way to get the date to the add form template ? but also if date is null it still throws an error.
The text was updated successfully, but these errors were encountered: