The Web Server provides a simple facility for writing tests for Web servlets and dispatchers.
The core functionality allows a request to be sent to the servlet and the response captured:
#:raw?boolean?
No arguments: a call to the root URL path with no bindings.
At least one argument: this may be a string, URL, or a request data structure.
Two arguments: the first argument must be a string or a URL, but the second argument can specify the request bindings.
The optional #:raw? keyword controls whether an X-expression or a byte string is returned as a result.
The optional #:headers? keyword controls whether the headers are included in the return value as a byte string. When this is used, the two returns are returned in a cons.
procedure
( make-servlet-tester servlet)→tester/c
This function accepts a servlet function and provides a tester function as described above. It is equivalent to (make-dispatcher-tester (dispatch/servlet servlet)), so if you need custom arguments to dispatch/servlet , use make-dispatcher-tester .
procedure
This facility is designed to be used in concert with a technique of extracting continuation URLs and relevant values; xml/path is one way to do this. Here is an extended example that tests an Add-Two-Numbers.com:
(test-add-two-numbers(test-add-two-numbers