Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

234
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!