From 1ff49b6597a9cf4a4339f7fa192a9431b681368d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=A8=E9=80=B8=E8=BE=B0?= Date: Sun, 19 Sep 2021 21:57:00 +0800 Subject: [PATCH] add authorization, update task data structure (#23) * add authorization, update task data structure * update header format --- prod/upload/upload.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/prod/upload/upload.lua b/prod/upload/upload.lua index 9c1b774..4584389 100644 --- a/prod/upload/upload.lua +++ b/prod/upload/upload.lua @@ -59,14 +59,16 @@ while true do local httpc = http.new() 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, 'authorization -> ', ngx.req.get_headers().Authorization) local res, err = httpc:request_uri( remote_url, { method = "POST", 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