Added a test to verify headers set by default middleware; refs #23939.
Removed redundant numbered parameters from str.format().

Since Python 2.7 and 3.1, "{0} {1}" is equivalent to "{} {}".