angular - GET request with Basic Auth token using Angular 6 getting 404 but works fine on Postman
问题描述
I'm trying to do a GET request on an external API. The api gave me a username and password which I encoded to get the Basic Token. When I test in on Postman everything works fine but when implementing it Angular 6 I get a 404 error, which is strange since I used the exact same URL in Postman. This is my code:
this.http.get('https://api.easypost.com/v2/shipments',{
headers:{
'Authorization':'Basic '+this.token
}
}
).subscribe((res:Response)=>{
console.log(res)
})
I don't understance why I'm getting a 404. The URL works fine in Postman. This is my networks tab:
解决方案
推荐阅读
- c# - C# - 通过串行端口从设备获取所有数据并检测控制字符(ACK、SOH、...)
- c# - 如何修复 Windows 窗体以仅加载完全禁用
- php - simple_dom_parser 中的多个元素
- windows - 自定义浏览器协议以使用参数打开 IE
- python - 如何删除 JSON 对象的属性
- angular-material - MatFormField 大纲问题
- python - 再次调用该函数时如何停止框架移动?
- c# - 无法在 ASP.Net MVC 中上传 Unity WebGL,出现错误“错误是:SyntaxError: expected expression, got '<”
- swift - 如何将字节转换为快速数组
- python-3.x - 使用 python BueatifulSoup 抓取 javascript 表