Comparison

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
comparison
equal deleted inserted replaced
10718:d229e4d31598 10719:977c9883f625
189 body = events.fire_event("http-error", { request = request, response = response, code = result }); 189 body = events.fire_event("http-error", { request = request, response = response, code = result });
190 end 190 end
191 elseif result_type == "string" then 191 elseif result_type == "string" then
192 body = result; 192 body = result;
193 elseif errors.is_err(result) then 193 elseif errors.is_err(result) then
194 response.status_code = result.code or 500;
194 body = events.fire_event("http-error", { request = request, response = response, code = result.code or 500, error = result }); 195 body = events.fire_event("http-error", { request = request, response = response, code = result.code or 500, error = result });
195 elseif promise.is_promise(result) then 196 elseif promise.is_promise(result) then
196 result:next(function (ret) 197 result:next(function (ret)
197 handle_result(request, response, ret); 198 handle_result(request, response, ret);
198 end, function (err) 199 end, function (err)