Proper test suite is needed, probably involving Test::HTTP::Server.