diff --git a/scripts/upload.lua b/scripts/upload.lua index a2561d5..80de5d0 100644 --- a/scripts/upload.lua +++ b/scripts/upload.lua @@ -75,13 +75,12 @@ local function verifyJwtToken(token) ) if not res then - ngx.status = ngx.HTTP_UNAUTHORIZED - ngx.header.content_type = "application/json; charset=utf-8" ngx.log(ngx.ERR, "CAN'T VERIFY JWT TOKEN -> ", err) - ngx.exit(ngx.HTTP_UNAUTHORIZED) + ngx.exit(ngx.HTTP_FORBIDDEN) else if 200 ~= res.status then ngx.log(ngx.ERR, "JWT TOKEN VERIFICATION *ERROR* -> ", err) + ngx.say(res.body) ngx.exit(res.status) end end @@ -195,11 +194,11 @@ while true do end if 201 ~= res.status then - ngx.log(ngx.ERR, "TASK CREATE *FAILED*", err) - ngx.say(err) - ngx.exit(res.status) + ngx.log(ngx.ERR, "TASK CREATE *FAILED*", res.body) + end ngx.say(res.body) + ngx.exit(res.status) break else -- do nothing diff --git a/scripts/upload_audio.lua b/scripts/upload_audio.lua index 717e43d..0f76674 100644 --- a/scripts/upload_audio.lua +++ b/scripts/upload_audio.lua @@ -45,11 +45,10 @@ local function create_task() end if 201 ~= res.status then - ngx.log(ngx.ERR, "TASK CREATE *FAILED*", err) - ngx.say(err) - ngx.exit(res.status) + ngx.log(ngx.ERR, "TASK CREATE *FAILED*", res.body) end ngx.say(res.body) + ngx.exit(res.status) end create_task()