Refactor header parsing in http provider