Closed
Description
- Version: 6.9.1
- Platform: Linux 4.4.0-21-generic logo ideas #37-Ubuntu SMP x86_64 x86_64 x86_64 GNU/Linux
- Subsystem: http
In short, calling writeHead()
with a ServerResponse
object which has no headers already set causes getHeader()
to return undefined
even if the header was set in the writeHead()
function call. I am unfamiliar with the project, so I'm unsure if this is defined behavior or not.
//Case 1: using setHeader, getHeader works as intended
res.setHeader("Location", "index.html");
res.getHeader("Location"); //index.html
//Case 2: using setHeader then writeHead, getHeader works as intended
res.setHeader("Set-Cookie", "hello=world");
res.writeHead(303, {Location: "index.html"});
res.getHeader("Location"); //index.html
//Case 3: using writeHead when res._headers is null, getHeader does not work as intended
res.writeHead(303, {Location: "index.html"});
res.getHeader("Location"); //undefined