diff --git a/prod/upload/upload.lua b/prod/upload/upload.lua index 46466f7..5aca65d 100644 --- a/prod/upload/upload.lua +++ b/prod/upload/upload.lua @@ -64,7 +64,7 @@ while true do { method = "POST", headers = { - host = "ngx" + ["Content-Type"] = "application/json" }, body = { cjson.encode({task_type = 1, data = files}) diff --git a/test/test_post.lua b/test/test_post.lua new file mode 100644 index 0000000..d5eae4f --- /dev/null +++ b/test/test_post.lua @@ -0,0 +1,29 @@ +local httpc = require("resty.http").new() + +-- Single-shot requests use the `request_uri` interface. +local res, err = httpc:request_uri("http://127.0.0.1:8080/api/v1/ts/create_task", { + method = "POST", + headers = { + ["Content-Type"] = "application/json", + }, + body = [[ + { + "created_at": "2021-08-30T11:34:25.845915", + "created_by": "quarkus_test", + "data": { + "pics": [ + "23f64c00-14d3-4e8a-bc73-10bfe79cd172", + "66ea4c4f-6394-4f97-92ea-e5cde4061d05", + "4ea1df10-b3a9-4f3c-8687-7e12c029e17b" + ] + }, + "task_status": "PENDING", + "task_type": "UPLOAD_PICTURE", + "updated_at": "2021-08-30T11:34:25.845929", + "updated_by": "quarkus_test" +} + ]] +}) + +ngx.say(res.status) +ngx.say(err)