package.cpath = '/usr/local/openresty/lualib/?.so;' .. package.cpath
package.path = '/usr/local/openresty/lualib/?.lua;' .. package.path
cjson = require "cjson"
wrk.method = "POST"
wrk.headers["Content-Type"] = "multipart/form-data; boundary=----WebKitFormBoundaryX3bY6PBMcxB1vCan"
bodyhead = "------WebKitFormBoundaryX3bY6PBMcxB1vCan"
bodyhead = bodyhead .. '\r\n'
bodyhead = bodyhead .. [[Content-Disposition: form-data; name="fileName1"; filename="手机端男长袖_04.jpg"]]
bodyhead = bodyhead .. '\r\n'
bodyhead = bodyhead .. 'Content-Type: image/jpeg'
bodyhead = bodyhead .. '\r\n'
bodyhead = bodyhead .. '\r\n'
file = io.open('/Users/louis/Desktop/手机端男长袖_04.jpg',"rb")
bodyhead = bodyhead .. file:read("*a")
bodyhead = bodyhead .. '\r\n'
bodyhead = bodyhead .. '------WebKitFormBoundaryX3bY6PBMcxB1vCan--'
wrk.body = bodyhead
io.close(file)
-- done = function(summary, latency, requests)
-- io.write("------------------------------\n")
-- print(cjson.encode(summary))
-- print(cjson.encode(latency))
-- print(cjson.encode(requests))
-- -- for _, p in pairs({ 50, 90, 99, 99.999 }) do
-- -- n = latency:percentile(p)
-- -- io.write(string.format("%g%%,%d\n", p, n))
-- -- end
-- end
-- response = function(status, headers, body)
-- print(body)
-- end