Skip to content

Instantly share code, notes, and snippets.

@smt116
Created March 18, 2015 14:52
Show Gist options
  • Save smt116/acaf11f50eb46428b4f3 to your computer and use it in GitHub Desktop.
Save smt116/acaf11f50eb46428b4f3 to your computer and use it in GitHub Desktop.
function string.random(length)
if length < 1 then return nil end
local str = ""
for i = 1, length do
n = math.random(32, 122)
if (n > 32 and n < 48) or (n > 57 and n < 65) or (n > 90 and n < 97) then n = math.random(97, 122) end
str = str .. string.char(n)
end
return str
end
wrk.method = "POST"
wrk.body = "title=" .. string.random(32) .. "&body=" .. string.random(1024 * 4)
wrk.headers["Content-Type"] = "application/x-www-form-urlencoded"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment