examples icon indicating copy to clipboard operation
examples copied to clipboard

response stream not correct

Open jiawei397 opened this issue 3 years ago • 0 comments

nodejs:

const express = require("express");
const app = express();

app.get('/', function (req, res) {
  res.write('hello\n');
  setTimeout(() => {
    res.write('world');
    res.end();
  }, 5000);
});
app.listen(3000);

When curl http://localhost:3000, it will show hello first, then wait 5 seconds show world.

But it shows hello world in 5 seconds together in Deno.

import express from "npm:[email protected]";
const app = express();
app.get("/", (req, res) => {
  res.write("hello\n");
  setTimeout(() => {
    res.write("world");
    res.end();
  }, 5000);
});

app.listen(3000);

jiawei397 avatar Dec 09 '22 06:12 jiawei397