add authorization, update task data structure (#23)

* add authorization, update task data structure

* update header format
This commit is contained in:
木逸辰
2021-09-19 21:57:00 +08:00
committed by GitHub
parent f730881fed
commit 1ff49b6597
+4 -2
View File
@@ -59,14 +59,16 @@ while true do
local httpc = http.new() local httpc = http.new()
local remote_url = string.format("%s/api/v1/ts/create_task", task_server) local remote_url = string.format("%s/api/v1/ts/create_task", task_server)
ngx.log(ngx.INFO, 'remote_url -> ', remote_url) ngx.log(ngx.INFO, 'remote_url -> ', remote_url)
ngx.log(ngx.INFO, 'authorization -> ', ngx.req.get_headers().Authorization)
local res, err = httpc:request_uri( local res, err = httpc:request_uri(
remote_url, remote_url,
{ {
method = "POST", method = "POST",
headers = { headers = {
["Content-Type"] = "application/json" ["Content-Type"] = "application/json",
["Authorization"] = ngx.req.get_headers().Authorization
}, },
body = cjson.encode({task_type = 1, data = files}), body = cjson.encode({task_type = 1, data = {images = files}}),
} }
) )
if 201 ~= res.status then if 201 ~= res.status then