添加proxy.conf.json后,我的代码在使用angular访问oxford dicitonary api时仍然显示404错误
getData(word: string) {
console.log('entered');
const firstHeaders = new HttpHeaders();
const headers: HttpHeaders = firstHeaders
.append('Accept', 'application/json')
.append('app_id', 'aaaaaa')
.append('app_key', 'adfhsdkfdkjfkdsj51');
console.log('reached');
return this.http.get(`/api/search/en?q=${word}&prefix=false`, {
headers });
}
{
"/api": {
"target": " https://od-api.oxforddictionaries.com",
"secure": true,
"changeOrigin": true,
"logLevel": "debug",
"headers": {
"Accept": "application/json",
"app_id": "*****",
"app_key": "****"
},
"pathRewrite": { "^/api": "" }
}
}