Fix bad logic in xhr that tries to avoid double-setting Content-Type

Fixes #18237.