我在服务器端(Java)上启用了CORS,并在Angular中调用API,但是由于CORB,我无法检索任何JSON数据。如果问题出在服务器端,则我具有Access-Control-Allow-Origin标头,但未读取类型application / json。如果是在客户端,则我的GET请求有以下内容:
return this.http.get(this.url, {headers: this.headers}).subscribe((res: HttpResponse<any>)=>{
console.log(res.body);
observe: 'response'
ResponseType: 'application/json'
RequestMethod: 'GET'
})