aboutsummaryrefslogtreecommitdiffstats
path: root/net/http/server.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2020-04-12 22:57:14 +0200
committerKim Alvefur <zash@zash.se>2020-04-12 22:57:14 +0200
commit4f2548e8efbb5659ed723cb4e802ef66328ada29 (patch)
tree6f2ed81a2c55c2b6746d99bb574666f6c9bd2dda /net/http/server.lua
parent6c597cc8d9ba1f6f98cd7f6e4dff697c73cd652c (diff)
downloadprosody-4f2548e8efbb5659ed723cb4e802ef66328ada29.tar.gz
prosody-4f2548e8efbb5659ed723cb4e802ef66328ada29.zip
net.http.server: Use error code from util.error (fixes #1502)
Oversight in 955e54e451dc when this was added.
Diffstat (limited to 'net/http/server.lua')
-rw-r--r--net/http/server.lua1
1 files changed, 1 insertions, 0 deletions
diff --git a/net/http/server.lua b/net/http/server.lua
index f4f67d18..c59479cd 100644
--- a/net/http/server.lua
+++ b/net/http/server.lua
@@ -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)