Skip to content

Commit

Permalink
Update adapter-node
Browse files Browse the repository at this point in the history
  • Loading branch information
benmccann committed Mar 31, 2021
1 parent 03d67ac commit 7c1cef4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
6 changes: 6 additions & 0 deletions .changeset/flat-pillows-think.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@sveltejs/adapter-node': patch
'@sveltejs/adapter-vercel': patch
---

Fix adapter-vercel query parsing and update adapter-node's
5 changes: 0 additions & 5 deletions .changeset/fluffy-carpets-confess.md

This file was deleted.

6 changes: 3 additions & 3 deletions packages/adapter-node/src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import fs from 'fs';
import polka from 'polka';
import { dirname, join } from 'path';
import sirv from 'sirv';
import { parse, URLSearchParams, fileURLToPath } from 'url';
import { URL, fileURLToPath } from 'url';
// eslint-disable-next-line import/no-unresolved
import { get_body } from '@sveltejs/kit/http';
// App is a dynamic file built from the application layer.
Expand Down Expand Up @@ -31,13 +31,13 @@ const assets_handler = sirv(join(__dirname, '/assets'), {

polka()
.use(compression({ threshold: 0 }), assets_handler, prerendered_handler, async (req, res) => {
const parsed = parse(req.url || '');
const parsed = new URL(req.url || '');
const rendered = await app.render({
method: req.method,
headers: req.headers, // TODO: what about repeated headers, i.e. string[]
path: parsed.pathname,
body: await get_body(req),
query: new URLSearchParams(parsed.query || '')
query: parsed.searchParams
});

if (rendered) {
Expand Down

0 comments on commit 7c1cef4

Please sign in to comment.