Closed nerzh closed 3 years ago
@nerzh support for this is in #57. In your example, this would be the result:
func testIssue63() throws {
struct A: Encodable {
var number: Int
}
struct B: Encodable {
var a: A? /// this Optional<A>
}
let encoded = try FormDataEncoder().encode(B(a: A(number: 1)), boundary: "-")
XCTAssertEqual(encoded, """
---\r
Content-Disposition: form-data; name="a[number]"\r
\r
1\r
-----\r\n
""")
}
yes, this behavior that I was expecting. Then I will check the versions of your library, for now thanks
oh, I saw, the pull request has not been accepted yet ...
Describe the bug
I don't know english... file FormDataEncoder.swift
and such optional objects follow the call path func singleValueContainer() -> SingleValueEncodingContainer
after the method is called
func encode(_ encodable: E, at codingPath: [CodingKey]) throws where E: Encodable {
and does not pass this test
encodable as? MultipartPartConvertible
because the struct A not conform MultipartPartConvertible
end