Because Elysia uses fast-querystring
to decode, treaty should use it to encode
#79
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.
fast-querystring
introduces several benefits when used to encode query strings:Unsafe URL characters are automatically encoded such that they are not misinterpreted by the server
Suppose an endpoint has
t.String({ format: 'email' })
on the query validator. If you tried to set the query string totest+1@test.com
validation would fail because for some reason, the server would see the value astest+ @test.com
or something. See: https://stackoverflow.com/questions/2322764/what-characters-must-be-escaped-in-an-http-query-stringBy using this package we solve this problem with minimal impact to perf.
Able to encode arrays
Looking at the example posted on the readme in the
fast-querystring
repo:We see that
fast-querystring
will also handle arrays. This is helpful when you have situations where you might want to apply multiple filters to a data-table component and much more.