首页 > 解决方案 > 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:

Networks Tab

标签: angularapigethttp-status-code-404postman

解决方案


推荐阅读