gluon-config-api-core: fixup function order

This commit is contained in:
lemoer 2021-08-12 02:40:29 +02:00
parent 2d2c71f11e
commit ea3cfbe8ac

View File

@ -59,6 +59,15 @@ local function pump(src, snk)
end
end
local function json_response(http, obj)
local result = json.stringify(obj, true)
http:header('Content-Type', 'application/json; charset=utf-8')
-- Content-Length is needed, as the transfer encoding is not chunked for
-- http method OPTIONS.
http:header('Content-Length', tostring(#result))
http:write(result..'\n')
end
local function get_request_body_as_json(http)
local request_body = ""
pump(http.input, function (data)
@ -93,15 +102,6 @@ local function verify_schema(schema, config)
return res
end
local function json_response(http, obj)
local result = json.stringify(obj, true)
http:header('Content-Type', 'application/json; charset=utf-8')
-- Content-Length is needed, as the transfer encoding is not chunked for
-- http method OPTIONS.
http:header('Content-Length', tostring(#result))
http:write(result..'\n')
end
entry({"v1", "config"}, call(function(http, renderer)
local parts = load_parts()