Changeset

10719:977c9883f625

net.http.server: Use error code from util.error (fixes #1502) Oversight in 955e54e451dc when this was added.
author Kim Alvefur <zash@zash.se>
date Sun, 12 Apr 2020 22:57:14 +0200
parents 10718:d229e4d31598
children 10722:3ddc7c9f35dc
files net/http/server.lua
diffstat 1 files changed, 1 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/net/http/server.lua	Sun Apr 12 17:30:16 2020 +0200
+++ b/net/http/server.lua	Sun Apr 12 22:57:14 2020 +0200
@@ -191,6 +191,7 @@
 	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)