I am trying to use UPS's package rating API and I am able to get this working in Postman but not on a web browser. I understand postman doesn't worry about CORS.
I have this post request:
getRate() {
return this.http.post(this.upsUrlTest, this.upsConfig, this.postOptions);
}
My 3 variables are:
upsUrlTest = 'https://wwwcie.ups.com/ship/1801/rating/Rate';
upsConfig = {...This is filled out and working in postman...}
postOptions = {
headers: new HttpHeaders({
transId: '0001',
transactionSrc: '##########', //Actual information is correct
AccessLicenseNumber: '########',
username: '#########',
password: '#########',
// These last two are where I believe the problem is
'Content-Type': 'application/json',
'Access-Control-Allow-Origin': 'x-requested-with, x-requested-by',
})
};
And I am getting this response:
What's strange is that I get a 404 before I get the CORS issue. I'm not sure if I have this formatted incorrectly or if there's something else going on here.
Another note: I am running this angular project on localhost, but I get the same issue when I put this on my server.
Edit: Just because this has to do with CORS doesn't make it a duplicate for my situation. A link to the proposed original would have sufficed in this case.