Created
July 11, 2017 14:22
-
-
Save stalkermn/bbd2b182fe15789a17c51ba2134ee1f5 to your computer and use it in GitHub Desktop.
wrk2 script example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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