On second thought - we should do all the work inside this `if` statement - no point in building `jsonHeaders` if we don't use it.