making it possible to pass in a plain javascript object as middleware
adding tests for middleware changes