BackendStack21/fast-gateway

Query parameter serialization changes style

Closed this issue · 1 comments

When using a specific query parameter serialization style it might be this lib changes the serialization for the upstream request.

queryString: req.query

This actually stores the parsed query params to queryString rather than the original string. Then for 'http' proxy type's fast-proxy-lite uses it's default serialization, which is comma separated:
https://github.com/BackendStack21/fast-proxy-lite/blob/eb9df39341a33591e2aee596d69e5aed8256561e/index.js#L141

Imho it'd be better to use the original query string - over the parsed one - to make sure no change happens. Otherwise, an easy option to specify the serialization style would be a good alternative - maybe in addition for a serialization callback (enum | function).

The above mentioned line of code could be changed to require('url').parse(req.url, false).query or require('url').parse(req.url, true).search - depending on if the leading ? needs to be included or not.

👍