I’m trying make a request with POST method, but when I run this,
login(username:string, password:string){
let data = JSON.stringify({username:username,password:password});
let headers = new Headers({ 'Content-Type': 'application/json' });
let options = new RequestOptions({headers:headers,method:RequestMethod.Post});
return this.http.post(APIHOST+'login', data,options)
.map(res => res.json())
.subscribe( data => {
console.log("Success!: ", data);
},err => {
console.log("ERROR!: ", err);
});
}
Debug with Developer Tools
Request URL:https://truckfy.herokuapp.com/login/
Request Method:GET
Status Code:405 Method Not Allowed
Remote Address:75.101.162.66:443
Please why this is run with GET method ?