feat: Replace serde_qs to serde_html_form #161
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fixes #160
serde_qs
was introduced in #25, and it did indeed correctly serialize parameters, even those that contained arrays.However, the serialized result is a format like
uris[0]=at%3A%2F%2Fdid%3A...&uris[1]=at%3A%2F%2Fdid%3A...
, and this behavior does not seem to be changeable.Not that this format is wrong, but it seems to cause problems when used in requests to servers that work with
express
, such as bluesky's appview.Specifically, in the
qs
library used by express, if we specify an index larger than20
by[]
notation, it is treated as an object key, and the query in the request is not correctly passed as an array.https://www.npmjs.com/package/qs#parsing-arrays
It would seem that this behavior could be avoided if it could be serialized with a format that does not include an index, such as
uris=at%3A%2F%2Fdid%3A...&uris=at%3A%2F%2Fdid%3A...
.There is a crate called
serde_html_form
that does exactly that and is used in axum and others.Replacing
serde_qs
with this library would solve the problem.