Mercurial > prosody-modules
comparison mod_data_access/mod_data_access.lua @ 1343:7dbde05b48a9
all the things: Remove trailing whitespace
author | Florian Zeitz <florob@babelmonkeys.de> |
---|---|
date | Tue, 11 Mar 2014 18:44:01 +0100 |
parents | 7e060edbb548 |
children | 8f17da746479 |
comparison
equal
deleted
inserted
replaced
1342:0ae065453dc9 | 1343:7dbde05b48a9 |
---|---|
76 if #path_items < 3 then | 76 if #path_items < 3 then |
77 return 404; | 77 return 404; |
78 end | 78 end |
79 | 79 |
80 local p_host, p_user, p_store, p_type = unpack(path_items); | 80 local p_host, p_user, p_store, p_type = unpack(path_items); |
81 | 81 |
82 if not p_store or not p_store:match("^[%a_]+$") then | 82 if not p_store or not p_store:match("^[%a_]+$") then |
83 return 404; | 83 return 404; |
84 end | 84 end |
85 | 85 |
86 if user_host ~= path_items[1] or user_node ~= path_items[2] then | 86 if user_host ~= path_items[1] or user_node ~= path_items[2] then |
97 | 97 |
98 data = data or dm_list_load(p_user, p_host, p_store); | 98 data = data or dm_list_load(p_user, p_host, p_store); |
99 | 99 |
100 --TODO Use the Accept header | 100 --TODO Use the Accept header |
101 local content_type = p_type or "json"; | 101 local content_type = p_type or "json"; |
102 if data and encoders[content_type] then | 102 if data and encoders[content_type] then |
103 response.headers.content_type = content_type_map[content_type].."; charset=utf-8"; | 103 response.headers.content_type = content_type_map[content_type].."; charset=utf-8"; |
104 return encoders[content_type](data); | 104 return encoders[content_type](data); |
105 else | 105 else |
106 return 404; | 106 return 404; |
107 end | 107 end |