Only setting content-type to JSON if there actually is content.