Software /
code /
prosody-modules
Diff
mod_rest/mod_rest.lua @ 4245:7bf3bf81c9ef
mod_rest: Use HTTP error mapping from net.http.errors
This was basically a subset
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 15 Nov 2020 15:17:50 +0100 |
parent | 4244:07c11080027e |
child | 4247:1f93fa24611d |
line wrap: on
line diff
--- a/mod_rest/mod_rest.lua Sat Nov 14 22:38:28 2020 +0100 +++ b/mod_rest/mod_rest.lua Sun Nov 15 15:17:50 2020 +0100 @@ -293,31 +293,7 @@ end end); - local code2err = { - [400] = { condition = "bad-request"; type = "modify" }; - [401] = { condition = "not-authorized"; type = "auth" }; - [402] = { condition = "not-authorized"; type = "auth" }; - [403] = { condition = "forbidden"; type = "auth" }; - [404] = { condition = "item-not-found"; type = "cancel" }; - [406] = { condition = "not-acceptable"; type = "modify" }; - [408] = { condition = "remote-server-timeout"; type = "wait" }; - [409] = { condition = "conflict"; type = "cancel" }; - [410] = { condition = "gone"; type = "cancel" }; - [411] = { condition = "bad-request"; type = "modify" }; - [412] = { condition = "bad-request"; type = "modify" }; - [413] = { condition = "resource-constraint"; type = "modify" }; - [414] = { condition = "resource-constraint"; type = "modify" }; - [415] = { condition = "bad-request"; type = "modify" }; - [429] = { condition = "resource-constraint"; type = "wait" }; - [431] = { condition = "resource-constraint"; type = "wait" }; - - [500] = { condition = "internal-server-error"; type = "cancel" }; - [501] = { condition = "feature-not-implemented"; type = "modify" }; - [502] = { condition = "remote-server-timeout"; type = "wait" }; - [503] = { condition = "service-unavailable"; type = "cancel" }; - [504] = { condition = "remote-server-timeout"; type = "wait" }; - [507] = { condition = "resource-constraint"; type = "wait" }; - }; + local code2err = require "net.http.errors".registry; local function handle_stanza(event) local stanza, origin = event.stanza, event.origin;