Skip to content

Commit

Permalink
Fix query params being empty
Browse files Browse the repository at this point in the history
  • Loading branch information
wiesson committed Mar 30, 2021
1 parent 96cbda3 commit 03d67ac
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/fluffy-carpets-confess.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/adapter-vercel': patch
---

Fix query params not being set
6 changes: 3 additions & 3 deletions packages/adapter-vercel/src/entry.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { URL, URLSearchParams } from 'url';
import { URL } from 'url';
// eslint-disable-next-line import/no-unresolved
import { get_body } from '@sveltejs/kit/http';

export default async (req, res) => {
const host = `${req.headers['x-forwarded-proto']}://${req.headers.host}`;
const { pathname, query = '' } = new URL(req.url || '', host);
const { pathname, searchParams } = new URL(req.url || '', host);

const { render } = await import('./server/app.mjs');

const rendered = await render({
method: req.method,
headers: req.headers,
path: pathname,
query: new URLSearchParams(query),
query: searchParams,
body: await get_body(req)
});

Expand Down

0 comments on commit 03d67ac

Please sign in to comment.