Mercurial > prosody-modules
comparison mod_storage_s3/mod_storage_s3.lua @ 5676:799f69a5921a
mod_storage_s3: Treat 404 to GET as a signal for empty data
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 14 Oct 2023 22:50:29 +0200 |
parents | 17ea26cf7259 |
children | b4632d5f840b |
comparison
equal
deleted
inserted
replaced
5675:17ea26cf7259 | 5676:799f69a5921a |
---|---|
115 return http.request(url.build(request), { method = method; headers = headers; body = payload }); | 115 return http.request(url.build(request), { method = method; headers = headers; body = payload }); |
116 end | 116 end |
117 | 117 |
118 -- coerce result back into Prosody data type | 118 -- coerce result back into Prosody data type |
119 local function on_result(response) | 119 local function on_result(response) |
120 if response.code == 404 and response.request.method == "GET" then | |
121 return nil; | |
122 end | |
120 if response.code >= 400 then | 123 if response.code >= 400 then |
121 error(response.body); | 124 error(response.body); |
122 end | 125 end |
123 local content_type = response.headers["content-type"]; | 126 local content_type = response.headers["content-type"]; |
124 if content_type == "application/json" then | 127 if content_type == "application/json" then |