Fix formats on xhr requests when HTTP_ACCEPT is empty string

Fix ActionDispatch::Request#formats on xhr requests when HTTP_ACCEPT
header is empty string. About issue #7774, same fix as in commit bebb02f
but for xhr requests.
Merge pull request #9541 from maximerety/fix_7774

Fix formats on xhr requests when HTTP_ACCEPT is empty string