net.http.server: Don't overwrite existing response.headers when returning a response object from a HTTP handler (waqas says it's wrong)

This commit is contained in:
Matthew Wild 2013-03-31 13:45:04 +01:00
parent 4f1aec3461
commit 48475bcf22

View file

@ -219,7 +219,13 @@ function handle_request(conn, request, finish_cb)
body = result;
elseif result_type == "table" then
for k, v in pairs(result) do
response[k] = v;
if k ~= "headers" then
response[k] = v;
else
for header_name, header_value in pairs(v) do
response.headers[header_name] = header_value;
end
end
end
end
response:send(body);