Set headers on get request angular 2

前端 未结 2 1414
伪装坚强ぢ
伪装坚强ぢ 2021-02-07 08:27

I try to set an Authorization header to a GET request to authenticate users to a rest API. I\'m using Angular 2 RC1. (I\'am a total beginner).

getTest(){
    let         


        
2条回答
  •  礼貌的吻别
    2021-02-07 09:17

    autorization =  { Authorization: 'Token adfasdfadf651f65asd1f65asdf' }
    
    this.http.get(url, { headers: autorization})
    

提交回复
热议问题