I can't understand why I can't use http put in Angular2.
When I'm doing http post, it give the correct request method:
However, when I use http put: it give OPTIONS as the request method:
I meant what the heck is this?
Here is the method that I'm using for post:
let headers = new Headers({ 'Content-Type': 'application/x-www-form-urlencoded' });
let options = new RequestOptions({ headers: headers });
var body = 'amount=' + 12;
this.http.post(this.host + '/orders', body, options)
.map(res => res.json())
.subscribe(data => {
resolve('success')
});
Here is the method that I'm using for PUT.
let headers = new Headers({ 'Content-Type': 'application/x-www-form-urlencoded' });
let options = new RequestOptions({ headers: headers });
let body = 'amount=' + 12;
this.http.put(this.host + '/orders/1', body, options)
.map(res => res.json())
.subscribe(data => {
resolve('success')
})

