Previously the module was created on configuration time, so it wasn't
possible to inject custom endpoints to the default interface.
error('[http] mmdblua library not found, please remove GeoIP configuration')
end
end
- M.add_interface(conf)
+
+ -- Add endpoints to default endpoints
+ local endpoints = conf.endpoints or {}
+ for k, v in pairs(M.endpoints) do
+ endpoints[k] = v
+ end
+ M.interface(conf.host, conf.port, endpoints, conf.cert, conf.key)
end
return M
done()
else
local request = require('http.request')
- local endpoints = require('http').endpoints
-
- -- custom endpoints
- endpoints['/test'] = {'text/custom', function () return 'hello' end}
-- setup resolver
modules = {
http = {
port = 0, -- Select random port
cert = false,
- endpoints = endpoints,
+ endpoints = { ['/test'] = {'text/custom', function () return 'hello' end} },
}
}