Encoding of space in query
See original GitHub issueHi
I have a problem. axios sends queries there space is encoded as + like
http://localhost:8080/abd/lucat/employees?search=Fredrik+Johansson&limit=10
and this results in an error from express-openapi-validator:
{"path":".query.search","message":"Parameter 'search' must be url encoded. It's value may not contain reserved characters."}
The line here includes + as a reserved character in queries https://github.com/cdimascio/express-openapi-validator/blob/master/src/middlewares/parsers/req.parameter.mutator.ts#L18
axios seems to working on this because even thou + is a standard is it several systems which don’t handle this. https://github.com/axios/axios/pull/2563
So how will you handle this?
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
In a URL, should spaces be encoded using %20 or +?
Within the query string, the plus sign is reserved as shorthand notation for a space. Therefore, real plus signs must be encoded. This...
Read more >URLEncoding of spaces in query parameters + vs %20
My problem is that any space is automatically encoded as a + and not as %20. While it is not necessarily wrong for...
Read more >Spaces and Uppercase characters in URLs - SISTRIX
Depending on the position of the spaces in a URL, different rules apply with regard to how those spaces are properly encoded. Uppercase...
Read more >Use %20 instead of + to encode spaces when submitting a ...
When I create the get request with query parameter that contains the space then it automatically encoded as a + and not as...
Read more >Solved: Handling white spaces in query params
RFC 3986 specifically omits spaces as valid elements of a URI. Typically user-agents will encode your URI for you when they encounter a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
In order to use reserved characters in query paramus, you can set
allowReserved: true
on the query parameter. https://swagger.io/docs/specification/describing-parameters/e.g.
Very good. Thank you 😊❤️