Open lizelive opened 2 years ago
Hey @lizelive ! Thanks for the suggestion.
I would consider accepting a PR that adds this as a configuration mode, but it's unlikely that I'll be able to get to adding this feature myself in the near future.
We do have an existing example that should help achieve the same functionality: https://github.com/samscott89/serde_qs/blob/main/examples/csv_vectors.rs
@lizelive any suggestion/idea how the API should look like?
And specially when we want to integrate it in http frameworks like actix:
#[derive(Deserialize)]
pub struct UsersFilter {
id: Vec<u64>,
}
// Use `QsQuery` extractor for query information.
// The correct request for this handler would be `/users?id[]=1124&id[]=88"`
async fn filter_users(info: QsQuery<UsersFilter>) -> HttpResponse {
HttpResponse::Ok().body(
info.id.iter().map(|i| i.to_string()).collect::<Vec<String>>().join(", ")
)
}
fn main() {
let app = App::new().service(
web::resource("/users")
.route(web::get().to(filter_users)));
}
qs docs state that
this would be much more readable