I was trying out angular2 for JavaScript and I was able to make a Http.get
request but when I tried to make a Http.post
request it would return 415 Unsupported Media Type
error.
The code itself is pretty concise, so I was not sure what could be causing this error. How would I resolve this issue?
var headers = new Headers();
headers.append('Content-Type', 'application/json');
console.log(headers.get('Content-Type'))
return this.http.post(this.endpoint_url, data="test.json", headers=headers).subscribe(
function(response){console.log("Success Response" + response)},
function(error){console.log("Error happened : " + error)});