@@ -68,11 +68,12 @@ const server = http.createServer(async (req, res) => {
68
68
url: req .url ,
69
69
method: req .method ,
70
70
headers: req .headers ,
71
- body: await new Promise ((resolve ) => {
72
- let body = ' ' ;
73
- req .on (' data' , (chunk ) => (body += chunk));
74
- req .on (' end' , () => resolve (body));
75
- }),
71
+ body : () =>
72
+ new Promise ((resolve ) => {
73
+ let body = ' ' ;
74
+ req .on (' data' , (chunk ) => (body += chunk));
75
+ req .on (' end' , () => resolve (body));
76
+ }),
76
77
raw: req,
77
78
});
78
79
res .writeHead (init .status , init .statusText , init .headers ).end (body);
@@ -119,11 +120,12 @@ const server = http2.createSecureServer(
119
120
url: req .url ,
120
121
method: req .method ,
121
122
headers: req .headers ,
122
- body: await new Promise ((resolve ) => {
123
- let body = ' ' ;
124
- req .on (' data' , (chunk ) => (body += chunk));
125
- req .on (' end' , () => resolve (body));
126
- }),
123
+ body : () =>
124
+ new Promise ((resolve ) => {
125
+ let body = ' ' ;
126
+ req .on (' data' , (chunk ) => (body += chunk));
127
+ req .on (' end' , () => resolve (body));
128
+ }),
127
129
raw: req,
128
130
});
129
131
res .writeHead (init .status , init .statusText , init .headers ).end (body);
@@ -155,11 +157,12 @@ app.use('/graphql', async (req, res) => {
155
157
url: req .url ,
156
158
method: req .method ,
157
159
headers: req .headers ,
158
- body: await new Promise ((resolve ) => {
159
- let body = ' ' ;
160
- req .on (' data' , (chunk ) => (body += chunk));
161
- req .on (' end' , () => resolve (body));
162
- }),
160
+ body : () =>
161
+ new Promise ((resolve ) => {
162
+ let body = ' ' ;
163
+ req .on (' data' , (chunk ) => (body += chunk));
164
+ req .on (' end' , () => resolve (body));
165
+ }),
163
166
raw: req,
164
167
});
165
168
res .writeHead (init .status , init .statusText , init .headers ).end (body);
@@ -227,7 +230,7 @@ await serve(
227
230
url: req .url ,
228
231
method: req .method ,
229
232
headers ,
230
- body: await req .text (),
233
+ body : () => req .text (),
231
234
raw: req ,
232
235
});
233
236
return new Response (body , init );
@@ -686,11 +689,12 @@ const server = http.createServer(async (req, res) => {
686
689
url: req .url ,
687
690
method: req .method ,
688
691
headers: req .headers ,
689
- body: await new Promise ((resolve ) => {
690
- let body = ' ' ;
691
- req .on (' data' , (chunk ) => (body += chunk));
692
- req .on (' end' , () => resolve (body));
693
- }),
692
+ body : () =>
693
+ new Promise ((resolve ) => {
694
+ let body = ' ' ;
695
+ req .on (' data' , (chunk ) => (body += chunk));
696
+ req .on (' end' , () => resolve (body));
697
+ }),
694
698
raw: req,
695
699
});
696
700
res .writeHead (init .status , init .statusText , init .headers ).end (body);
0 commit comments