changes to formatRequest to better handle extra headers