I have an middleware which checks that some parameters in request\'s header are correct, and I check that there is one entity in db associated with one parameter from header (e.