comparison mod_rest/mod_rest.lua @ 4888:dc7c9ae15f43

mod_rest: Ensure mod_http is loaded before API demo Fixes an error as it tried to use module:http_url() which doesn't exist before mod_http is loaded
author Kim Alvefur <zash@zash.se>
date Tue, 08 Feb 2022 13:51:41 +0100
parents f69c5a443156
children 9d0ec61c70a1
comparison
equal deleted inserted replaced
4887:806f7c8d830b 4888:dc7c9ae15f43
382 module:send(payload, origin); 382 module:send(payload, origin);
383 return 202; 383 return 202;
384 end 384 end
385 end 385 end
386 386
387 module:depends("http");
388
387 local demo_handlers = {}; 389 local demo_handlers = {};
388 if module:get_option_path("rest_demo_resources", nil) then 390 if module:get_option_path("rest_demo_resources", nil) then
389 demo_handlers = module:require"apidemo"; 391 demo_handlers = module:require"apidemo";
390 end 392 end
391 393
392 -- Handle stanzas submitted via HTTP 394 -- Handle stanzas submitted via HTTP
393 module:depends("http");
394 module:provides("http", { 395 module:provides("http", {
395 route = { 396 route = {
396 POST = handle_request; 397 POST = handle_request;
397 ["POST /*"] = handle_request; 398 ["POST /*"] = handle_request;
398 ["GET /*"] = handle_request; 399 ["GET /*"] = handle_request;