fac-13 / HEII-topics

website where you can log in, post topics and vote on topics
https://heii-voting-topics.herokuapp.com/
2 stars 1 forks source link

Multiple status codes #25

Closed hannahcmtucker closed 6 years ago

hannahcmtucker commented 6 years ago

Usually you would only send back one HTTP status code in your response from the server:

        response.writeHead(200, { 'content-type': 'text/plain' });
        response.writeHead(303, { Location: '/' });

I think in this case the 303 will be probably overriding the 200.

If you want to set multiple headers on your response, you can do it by including more than one key/value pair in the object you pass to writeHead

        response.writeHead(303, { 'content-type': 'text/plain', Location: '/' });

https://nodejs.org/api/http.html#http_response_writehead_statuscode_statusmessage_headers