'Failed to Decode JSON error in Angular Http
$scope.reload = function(){
send = {
method: 'GET',
url: '/pipelines',
data: JSON.stringify({"type":$scope.selectedType,"Plan":$scope.selectedPlan}),
headers: {
'Content-Type': 'application/json; charset=utf-8'
}
};
console.log(send);
$http(send).then(function(response){
$scope.pipelines = response.data;
},function(error){
console.log(error);
});
This leads to Bad request and console outputs error as
<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2 Final//EN\">\n<title>400 Bad Request</title>\n<h1>Bad Request</h1>\n<p>Failed to decode JSON object: Expecting value: line 1 column 1 (char 0)</p>\n"
This is using AngularJS 1.6 for.
I am trying to figure out What is wrong with the JSON object.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
