“在解析http:// localhost:8080 /时Http失败”

时间:2018-12-15 00:19:44

标签: json angular

extractData = (res: Response | any) => {
  return res.body || {};
}

getData() {
 return this.http.get('http://localhost:8080/test',
      observe: 'response' 
      ).pipe(
      map(this.extractData));
}

该呼叫成功,我可以在“网络”选项卡中看到响应,但是当我尝试在控制台中记录响应时,出现了解析错误。谁能帮我

1 个答案:

答案 0 :(得分:0)

getData()函数没有提到任何返回类型。