Using HTTP response nullptr for status other than 200

Using HTTP is there anyway to get the content of a response when the status is not 200 (for example 401 unauthorized) currently the response is a nullptr when not 200-ok.
Currently using node.js to test

Line 1140 of CurlHttp.cpp sets the HTTP response to nullptr if the response is not valid, which it was. Because the header was being written after the content.

Node.js code

//create a server object:
http.createServer(async function (req, res) {
	console.log("Not found");
	res.write('Not Found'); //write a response to the client
	res.writeHead(404, { 'Content-Type': 'text/plain' }); 
	res.end(); //end the response
}).listen(8080); //the server object listens on port 8080