[misc] reland 3004: unify detection of json requests and skip issuing of redirects GitOrigin-RevId: fa43b3b4d23deb581496ed70ae8f28b805555d64