Remove hardcoded query params in adapter.

This commit is contained in:
Dillon Kearns 2021-12-21 16:11:51 -08:00
parent 862d0ce46f
commit 7c3de6c149

View File

@ -188,11 +188,17 @@ async function render(event, context) {
* @returns {{ method: string; hostname: string; query: string; headers: Object; host: string; pathname: string; port: number | null; protocol: string; rawUrl: string; }}
*/
function reqToJson(req) {
const queryString = req.multiValueQueryStringParameters ? Object.entries(req.multiValueQueryStringParameters).reduce(
(acc, [key, values]) => {
return acc + values.map(value => \`\${encodeURIComponent(key)}=\${encodeURIComponent(value)}\`).join('&')
}
, "") : '';
return {
method: req.httpMethod,
hostname: "TODO",
// query: req.queryStringParameters, //url.search ? url.search.substring(1) : "",
query: "", //url.search ? url.search.substring(1) : "",
query: queryString,
headers: req.headers,
host: "", // TODO
pathname: req.path,