hummingbird-project / hummingbird

Lightweight, flexible HTTP server framework written in Swift
Apache License 2.0
1.16k stars 54 forks source link

Add support for parsing URL encoded form arrays of structs #545

Open adam-fowler opened 1 month ago

adam-fowler commented 1 month ago

We should be able to encode and decode arrays of structs eg

struct Person {
    let name: String
    let age: Int
}
struct People {
    let p: [Person]
}

should be represented as

p[0][name]=John&p[0][age]=23&p[1][name]=Jane&p[1][age]=67
connor-ricks commented 1 week ago

Whatever you land it, it might be relevant to allow overriding of the encoding/decoding strategy for arrays specifically. I don't think is an official standard for handling arrays in query parameters, but there are a few "common" implementations, so it might be worth having a "strategy" style enum.