ticket:3 test for middleware that stores requests in db
(cherry picked from commit 2bf55feb5db2e08a742d5ffad92df18b8430898d)