我正在尝试使用来自 Rapidapi 的 SkyScanner API 和 Angular 来搜索航班价格。这是我的代码
headers = new Headers();
url:string;
constructor(private _http:HttpClient,) {
this.headers.append('X-RapidAPI-Key', 'MY-KEY');
this.url = 'https://skyscanner-skyscanner-flight-search-v1.p.rapidapi.com/apiservices/browseroutes/v1.0/IE/EUR/en-GB/{here should be other parameters like destination}' }
我从输入中传递从、到、日、月和年
getFlightDetail(from,to,day,month,year) : Observable<Iflight>{
return this._http.get<Iflight>(this.url+this.headers)
.pipe(
tap(data => console.log('flightData/error' + JSON.stringify(data))
),
catchError(this.handlerError)
);
}
问题是当我运行我得到的应用程序
<块引用>401 未经授权