Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

230
Vistas
How to response dynamic content in Nodejs without Express
      let reqBody = "";
      req
        .on("data", (chunk) => {
          reqBody += chunk.toString();
        })
        .on("end", () => {
        const body = new URLSearchParams(reqBody);
        res.end("ok");
        });

I'm trying to access the request's body using NodeJS without Express but for some reason, I could not run res.end("ok");.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You need to call req.end() as well

check Node.js document https://nodejs.org/api/http.html

With http.request() one must always call req.end() to signify the end of the request - even if there is no data being written to the request body

 let reqBody = "";
  req
    .on("data", (chunk) => {
      reqBody += chunk.toString();
    })
    .on("end", () => {
    const body = new URLSearchParams(reqBody);
    res.end("ok");
    });
   req.end();
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda