Diff

net/http/server.lua @ 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
parent 10501:e8186aba1583
child 10952:05d218aae3d1
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)