How would I go about unittesting a vibe.d app?

rinfz cherez at
Fri Oct 30 13:26:59 UTC 2020

For example, I am trying to test a route. Within the unittest I 
setup the server locally (note: is it possible to start the 
server once for all unit tests?), then call listenHTTP. After the 
listen call I make a client request to localhost with requestHTTP 
and I get the following error:

WARNING: HTTPClientResponse not fully processed before being 

The code for reference:

unittest {
// imports...
auto listener = setupServer(); // makes the listenHTTP call
scope(exit) listener.stopListening();

   environment["HOST"] ~ "/register",
   (scope req) {
     req.method = HTTPMethod.POST;
     req.writeFormBody(["foo": "bar"]);
   (scope res) {
     assert (res.statusCode == 200);

Note: I am running tests using dub if that is relevant.

More information about the Digitalmars-d-learn mailing list