HackerYou / chalk-api

2 stars 7 forks source link

Response Status Codes #118

Open swbloom opened 7 years ago

swbloom commented 7 years ago

(apologies if this is incorrect)

The API sends a lot of 200 status codes for things that probably should have a more specific status code - for example, a failed authentication sends a 200 when (i think) it should send a 401.

I believe this is because res.send defaults a 200 if you don't explicitly send a status code, but again I could be misinterpreting this.

This will be helpful on the front end because it allows for a programmatic way to isolate behaviour based on status code responses, something like:

    if (error.status === 401) {
        logOutUser();
    }