Created
March 16, 2016 15:50
-
-
Save oberhamsi/8eb7da0b7e4e04874c1e to your computer and use it in GitHub Desktop.
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
--- apt-get install lua-cjson | |
local cjson = require "cjson" | |
local cjson2 = cjson.new() | |
math.randomseed(os.time()) | |
local headers = {} | |
headers["Content-Type"] = "application/json" | |
local platforms = {'moz', 'gcm', 'invalid-platform'}; | |
local text = "0123456789abcdefghijklmnopqrstuvwxyz" | |
local chars = {} | |
for i = 1, #text do | |
chars[i] = text:sub(i, i) | |
end | |
rndstring = function(len) | |
local str = "" | |
for i= 0,len do | |
str = str .. chars[math.random(#chars)] | |
end | |
return str | |
end | |
-- /subscribe/:channel | |
-- token, platform (moz, gcm) | |
request = function() | |
local token = rndstring(50) | |
local body = cjson.encode({ | |
token = rndstring(50), | |
platform = platforms[math.random(#platforms)] | |
}) | |
-- | |
--- print (body) | |
return wrk.format('POST', '/api/subscribe/channelwahl', headers, body) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment