[HttpFoundation] Request->getRequestFormat should only rely on the request attributes

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | possibly
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #8966
| License       | MIT
| Doc PR        | 

Added test case and fix for #8966. Is this functionality relied on somewhere?