Small fixes to the HTTP handler. Added a basic unit test - needs more work.