Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F3050959
http_incomingmessage_async_iter.mjs
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
583 B
Referenced Files
None
Subscribers
None
http_incomingmessage_async_iter.mjs
View Options
import { createServer } from 'node:http';
const server = createServer(async (req, res) => {
const chunks = [];
for await (const chunk of req) chunks.push(chunk);
res.writeHead(200, { 'content-type': 'text/plain' });
res.end(Buffer.concat(chunks).toString('utf8'));
});
server.listen(0, async () => {
const address = server.address();
const response = await fetch(`http://127.0.0.1:${address.port}/`, {
method: 'POST',
body: 'hello-body',
});
console.log(`status:${response.status}`);
console.log(`text:${await response.text()}`);
server.close();
});
File Metadata
Details
Attached
Mime Type
application/javascript
Expires
Fri, Apr 3, 2:55 PM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
521508
Default Alt Text
http_incomingmessage_async_iter.mjs (583 B)
Attached To
Mode
rANT Ant
Attached
Detach File
Event Timeline
Log In to Comment