Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

15
  • 1
    I guess I should have looked at the doc a little closer... I was just trying to use the shortcut methods. This works great. Thanks. Commented Aug 9, 2012 at 4:56
  • 17
    @dnc253 This works with shortcut methods too. The code would be $http.get('www.google.com/someapi', {headers: {'Authorization': 'Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=='}}); Commented Aug 9, 2012 at 4:59
  • 1
    Is there a way to extend $http (while maintaining "injectability" and not having to apply it to the default header collection) to automatically add this header for you? Seems kind of redundant to always have to add the header for every secure call you make. Commented Jul 12, 2013 at 20:35
  • 32
    Doesn't work for me. None of the headers I add in this way get added to the actual request. Commented Nov 29, 2013 at 9:33
  • 4
    Whenever I try to set the headers, my request goes out as an OPTION Request, consequently my endpoint returns a 404 NOT FOUND which makes sense: It only knows a GET /someResource not OPTIONS /someResource Commented Apr 9, 2015 at 19:17