Only set content-type to JSON header if we expect JSON to be sent