Open MaJiangBo opened 6 years ago
my code: public interceptBefore(request: InterceptedRequest): InterceptedRequest {
let jwt = localStorage.getItem('token'); let authHeader = new Headers(); if(jwt) { authHeader.append('Authorization', 'Bearer ' + jwt); } authHeader.append('Content-Type', 'application/json;charset=UTF-8'); request.interceptorOptions={ headers: authHeader, } // request.options={ // headers: authHeader, // } console.log("请求地址为:"+ request.url) return request; }
when I use request.options={ headers: authHeader, } The post request becomes get
but use: request.interceptorOptions={ headers: authHeader, } don't have that question.
my code: public interceptBefore(request: InterceptedRequest): InterceptedRequest {
when I use
request.options={ headers: authHeader, } The post request becomes get
but use: request.interceptorOptions={ headers: authHeader, } don't have that question.