test for csrf middleware
refactor middlewares