refactor($http): avoid re-creating execHeaders function

The execHeaders function was being re-defined inside mergeHeaders
function. Additionally it was mutating its arguments thus making code 
harder to read / reason about.

There are some other problems with this function (inconsistent treatment for null / undefined headers coming from an object value as compared to being result of a function execution) but let's tackle those one by one.