Unexpected Buffer Response When Sending JSON Data to Echo Server

When sending a simple JSON object to my echo server, I encountered an issue where the response received was an empty object. Additionally, upon including a Content-Type: application/json header, I started receiving a buffer instead of the expected JSON response.

Test server:

const [app = express()] = [require('express')];

app.post("/echo", (req, res) => {
  return res.json(req.body);
})

app.listen(3000, function () {
  console.log(`Testbench started on port: ${3000}`);
});

Please authenticate to join the conversation.

Upvoters
Status

Needs Triage

Board

Feedback

Tags

Bug

Date

Over 1 year ago

Author

i-usebruno

Subscribe to post

Get notified by email when there are changes.