exposing this middleware so we can test it