HTTP Test Tool

Lua Support


Httest 2.1.6 do integrate the famous Lua scripting language.

Simple Example

BLOCK:LUA myLuaTest param1 param2 : ret1 ret2 ret3
  for i=1,10 do
    print("hallo "..i.." "..param1.." "..param2)
  end
  return "foo", "bar", "bla"
END

CLIENT
_CALL myLuaTest "hello" "world" FOO BAR BLA
_DEBUG $FOO $BAR $BLA
END

Extended Example

Extend the example with more CLIENT code

CLIENT
_CALL myLuaTest hello world FOO BAR BLA
_DEBUG $FOO $BAR $BLA

_REQ localhost 80
__GET / HTTP/1.1
__Host: localhost
__
_WAIT BUF

_CALL myLuaTest VAR(BUF) "hello world" FOO BAR BLA
END

The recieved BUF is handover to myLuaTest without resolving it, the lua block do this. Resolving on call would be also possible, but musst be quoted AND must not contain quotes.