learnyounode icon indicating copy to clipboard operation
learnyounode copied to clipboard

HTTP JSON API SERVER does not check 200, 404

Open piannaf opened this issue 9 years ago • 1 comments

Although it is just a hint to return 200 with appropriate header:

You should also be a good web citizen and set the Content-Type properly:
    res.writeHead(200, { 'Content-Type': 'application/json' })

the official solution has this as well as 404 if a URL other than "/api/parsetime" or "/api/unixtime" is requested.

My opinion is if the official solution has it, it should be verified for the submitted solution.

I like the idea that the workshopper enforces being a "good web citizen" in the few last exercises, but I'm not married to it. Let's discuss here if the 200 and 404 should be checked.

piannaf avatar Sep 11 '15 06:09 piannaf

It seems like a reasonable request.

martinheidegger avatar Nov 04 '15 17:11 martinheidegger