mirror of
https://github.com/withastro/astro.git
synced 2024-12-16 21:46:22 -05:00
[ci] format
This commit is contained in:
parent
cf8a7e933d
commit
a36d51d433
3 changed files with 7 additions and 5 deletions
|
@ -217,7 +217,7 @@ async function handleRequest(
|
|||
if (!(req.method === 'GET' || req.method === 'HEAD')) {
|
||||
let bytes: Uint8Array[] = [];
|
||||
await new Promise((resolve) => {
|
||||
req.on('data', part => {
|
||||
req.on('data', (part) => {
|
||||
bytes.push(part);
|
||||
});
|
||||
req.on('end', resolve);
|
||||
|
|
|
@ -2,7 +2,7 @@ import { expect } from 'chai';
|
|||
import * as cheerio from 'cheerio';
|
||||
import { loadFixture } from './test-utils.js';
|
||||
import * as fs from 'fs';
|
||||
import { FormData, File } from 'node-fetch'
|
||||
import { FormData, File } from 'node-fetch';
|
||||
|
||||
describe('API routes', () => {
|
||||
/** @type {import('./test-utils').Fixture} */
|
||||
|
|
|
@ -56,14 +56,16 @@ describe('API routes in SSR', () => {
|
|||
});
|
||||
|
||||
it('Can be passed binary data from multipart formdata', async () => {
|
||||
const formData = new FormData();
|
||||
const raw = await fs.promises.readFile(new URL('./fixtures/ssr-api-route/src/images/penguin.jpg', import.meta.url));
|
||||
const formData = new FormData();
|
||||
const raw = await fs.promises.readFile(
|
||||
new URL('./fixtures/ssr-api-route/src/images/penguin.jpg', import.meta.url)
|
||||
);
|
||||
const file = new File([raw], 'penguin.jpg', { type: 'text/jpg' });
|
||||
formData.set('file', file, 'penguin.jpg');
|
||||
|
||||
const res = await fixture.fetch('/binary', {
|
||||
method: 'POST',
|
||||
body: formData
|
||||
body: formData,
|
||||
});
|
||||
|
||||
expect(res.status).to.equal(200);
|
||||
|
|
Loading…
Reference in a new issue