Bird
0
0

Consider this Express code:

medium📝 component behavior Q5 of 15
Node.js - HTTP Module
Consider this Express code:
app.get('/data', (req, res) => { res.sendStatus(204); });
What will the client receive?
AStatus 200 with empty body
BStatus 204 with 'No Content' text body
CStatus 204 with no content body
DStatus 500 with error message
Step-by-Step Solution
Solution:
  1. Step 1: Understand status 204 meaning

    Status 204 means 'No Content' and should not have a response body.
  2. Step 2: Check res.sendStatus(204) behavior

    It sets status 204 and sends no content body as per HTTP spec.
  3. Final Answer:

    Status 204 with no content body -> Option C
  4. Quick Check:

    204 means no content, so no body sent [OK]
Quick Trick: 204 status means no content body sent [OK]
Common Mistakes:
  • Expecting text body with 204 status
  • Confusing 204 with 200 status
  • Assuming res.sendStatus sends message text

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Node.js Quizzes