fix request/response asymmetry bug in middleware