I am trying to do a POST request with headers to get a response. Below is the Angular code I am using for request.
const headers = new HttpHeaders({
'Content-Type': 'text/plain',
'Token':'$1$IGinaeBw$Z2kYO175lQ5t2H5HWCdOV1',
'User-Id':'1'
});
this.http.get('http://localhost/simple-codeigniter-rest-api-master/index.php/book/', {headers:headers} )
.map(user => {
if (user) {
localStorage.setItem('currentUser', JSON.stringify(user));
}
console.log(user);
return user;
});
Below is the issue I am getting in the console.
Its working fine in PSOTMAN though. Since angular version is upgrading constantly. I am not sure what's the issue.
Note: JQuery AJAX call is working fine.
POSTMAN screenshot: