Added a test to verify headers set by default middleware; refs #23939.

You'll probably need to skip this test on Python 3.2, too.