@@ -4,13 +4,11 @@ import { HTTPMethod } from '@php-wasm/universal';
44import express from 'express' ;
55import compression from 'compression' ;
66import compressible from 'compressible' ;
7- import fileUpload from 'express-fileupload' ;
87import { portFinder } from './port-finder' ;
98import { NodePHP } from '@php-wasm/node' ;
109import startWPNow from './wp-now' ;
1110import { output } from './output' ;
1211import { addTrailingSlash } from './add-trailing-slash' ;
13- import { encodeAsMultipart } from './encode-as-multipart' ;
1412
1513const requestBodyToBytes = async ( req ) : Promise < Uint8Array > =>
1614 await new Promise ( ( resolve ) => {
@@ -45,7 +43,6 @@ export async function startServer(
4543 ) ;
4644 }
4745 const app = express ( ) ;
48- app . use ( fileUpload ( { defCharset : 'utf8' , defParamCharset : 'utf8' } ) ) ;
4946 app . use ( compression ( { filter : shouldCompress } ) ) ;
5047 app . use ( addTrailingSlash ( '/wp-admin' ) ) ;
5148 const port = options . port ?? await portFinder . getOpenPort ( ) ;
@@ -61,19 +58,11 @@ export async function startServer(
6158 }
6259 }
6360
64- let body : Uint8Array ;
65- if ( requestHeaders [ 'content-type' ] ?. startsWith ( 'multipart/form-data' ) ) {
66- const multipart = await encodeAsMultipart ( req ) ;
67- body = multipart . bytes ;
68- requestHeaders [ 'content-type' ] = multipart . contentType ;
69- } else {
70- body = await requestBodyToBytes ( req ) ;
71- }
7261 const data = {
7362 url : req . url ,
7463 headers : requestHeaders ,
7564 method : req . method as HTTPMethod ,
76- body,
65+ body : await requestBodyToBytes ( req ) ,
7766 } ;
7867 const resp = await php . request ( data ) ;
7968 res . statusCode = resp . httpStatusCode ;
0 commit comments