sync/ajax: cleanup how headers are set

No need for loop anymore.