HTTP Test Tool

Javascript Support


Httest 2.2.0 do integrate the spidermonkey javascript engine from mozilla.

Simple Example


BLOCK:JS myJsTest param1 param2 : ret
  return param1 + " " + param2;
END

CLIENT
_CALL myJsTest "hello" "world" result
_DEBUG $result
END

Extended Example

Extend the example with more CLIENT code


CLIENT
_CALL myJsTest hello world result
_DEBUG $result

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

_CALL myJsTest "Received buf is: VAR(BUF) result
_DEBUG $result
END

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