3

I was programming a nodejs app using an api written by two other devs in my company. I tried catching the cases where the requests fail, but it just did not work. Then i found out what the reason was: Apparently the other devs thought, it is enough to send the appropriate status in the json body and did not set it in the headers, so I always got a 200 back even if it failed and there was no usable data in the body.

Comments
  • 1
    You can always read raw response, no need for headers.

    P.S. I know it should be with proper headers, but most ppl in industry when sending back JSON response will just print/echo the string, and only for media files, would set proper header...
Add Comment