added midleware test to handler