net.http.server: Use error code from util.error (fixes #1502)

Oversight in 955e54e451dc when this was added.
This commit is contained in:
Kim Alvefur 2020-04-12 22:57:14 +02:00
parent 6c597cc8d9
commit 4f2548e8ef

View file

@ -191,6 +191,7 @@ local function handle_result(request, response, result)
elseif result_type == "string" then
body = result;
elseif errors.is_err(result) then
response.status_code = result.code or 500;
body = events.fire_event("http-error", { request = request, response = response, code = result.code or 500, error = result });
elseif promise.is_promise(result) then
result:next(function (ret)