Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Replace serde_qs to serde_html_form #161

Merged
merged 1 commit into from
Apr 22, 2024
Merged

Conversation

sugyan
Copy link
Owner

@sugyan sugyan commented Apr 22, 2024

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 than 20 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.

@sugyan sugyan changed the title Replace serde_qs to serde_html_form feat: Replace serde_qs to serde_html_form Apr 22, 2024
@sugyan sugyan merged commit 5ab569e into main Apr 22, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

app.bsky.feed.getPosts fails with more than a certain number of arguments uris
1 participant