Refactor middlewares to use LJSRequest object.