Mercurial > prosody-modules
comparison mod_rest/mod_rest.lua @ 3814:0dede5b0ab27
mod_rest: Fix return status when sending and forgetting
Turns out module:send() doesn't return anything, so there's no way to
know if it was routed successfully.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 01 Jan 2020 16:35:55 +0100 |
parents | aa1ad69c7c10 |
children | 1a0a612d36bc |
comparison
equal
deleted
inserted
replaced
3813:aa1ad69c7c10 | 3814:0dede5b0ab27 |
---|---|
131 module:log("debug", "Sending[rest]: %s", stanza:top_tag()); | 131 module:log("debug", "Sending[rest]: %s", stanza:top_tag()); |
132 response.headers.content_type = send_type; | 132 response.headers.content_type = send_type; |
133 response:send(encode(send_type, stanza)); | 133 response:send(encode(send_type, stanza)); |
134 return true; | 134 return true; |
135 end | 135 end |
136 if module:send(payload, origin) then | 136 module:send(payload, origin); |
137 return 202; | 137 return 202; |
138 else | |
139 return 500; | |
140 end | |
141 end | 138 end |
142 end | 139 end |
143 | 140 |
144 -- Handle stanzas submitted via HTTP | 141 -- Handle stanzas submitted via HTTP |
145 module:depends("http"); | 142 module:depends("http"); |