request handler and tests for it