Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chore] Make rawBody be the bytes #2215

Merged
merged 16 commits into from
Aug 17, 2021
Prev Previous commit
Next Next commit
update adapter-netlify
  • Loading branch information
JeanJPNM committed Aug 16, 2021
commit 82eb36896596493359de122e966e2e8a9972b804
10 changes: 2 additions & 8 deletions packages/adapter-netlify/files/entry.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// TODO hardcoding the relative location makes this brittle
import { init, render } from '../output/server/app.js'; // eslint-disable-line import/no-unresolved
import { isContentTypeTextual } from '@sveltejs/kit/adapter-utils'; // eslint-disable-line import/no-unresolved

init();

Expand All @@ -9,13 +8,8 @@ export async function handler(event) {

const query = new URLSearchParams(rawQuery);

const type = headers['content-type'];
const rawBody =
type && isContentTypeTextual(type)
? isBase64Encoded
? Buffer.from(body, 'base64').toString()
: body
: new TextEncoder('base64').encode(body);
const encoding = isBase64Encoded ? 'base64' : headers['content-encoding'] || 'utf-8';
const rawBody = typeof body === 'string' ? Buffer.from(body, encoding) : body;

const rendered = await render({
method: httpMethod,
Expand Down