这是我正在使用的服务... 请求标头不显示任何访问授权。
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { HttpErrorResponse, HttpHeaders } from '@angular/common/http';
import {Http, Headers, RequestOptions} from '@angular/http';
import { Config } from "../config";
@Injectable()
export class HomeService {
headers: any;
options: any;
constructor(private http: HttpClient) {
this.headers = new Headers({'Content-Type':'application/json'});
this.headers.append('Authorization', 'Bearer ' + localStorage.getItem('userToken'));
this.options = new RequestOptions({headers: this.headers});
}
getLoginUserDetails(){
return this.http.post(Config.apiEndPoint + "get-login-user", { headers: this.options});
}
}
有什么解决办法让我知道吗?