Skip to content

Instantly share code, notes, and snippets.

@stalkermn
Created July 11, 2017 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stalkermn/bbd2b182fe15789a17c51ba2134ee1f5 to your computer and use it in GitHub Desktop.
Save stalkermn/bbd2b182fe15789a17c51ba2134ee1f5 to your computer and use it in GitHub Desktop.
wrk2 script example
request = function()
category = uuid()
path = "/weber_api/send_message/v1/"
wrk.headers["Content-Type"] = "application/json; charset=utf-8"
wrk.headers["x-auth-id"] = "valid_AUTH_Session"
wrk.body = "{\"weber_message\":[{\"id\":\""..category.."\",\"dst_addr\":\"+___\",\"category\":\""..category.." \",\"message_template\":[{\"text\":\"Тестовое сообщение!\"}]}]}"
return wrk.format("POST", path)
end
random = math.random
function uuid()
local template ='xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'
return string.gsub(template, '[xy]', function (c)
local v = (c == 'x') and random(0, 0xf) or random(8, 0xb)
return string.format('%x', v)
end)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment