AngularJS 406 not acceptable http post request AngularJS 406 not acceptable http post request json json

AngularJS 406 not acceptable http post request


You should to send a json data to your server try this following code by adding 'Accept': 'application/json, */*' to your header:

var edit = function(form){var token = window.localStorage.getItem('token');$ionicLoading.show();return $http({       method  : 'POST',       url     : API.url + '/user',       headers : {          Authorization : 'Bearer ' + token,         'Accept': 'application/json, */*'       },       transformRequest: function(data, headers){            console.log(headers);            headers = angular.extend({}, headers, {'Content-Type': 'application/json;charset=UTF-8'});            console.log(headers);            console.log(data);            console.log(angular.toJson(data));            return angular.toJson(data); // this will go in the body request            },           data    : form   }).then(function(result) {    console.dir(result.data);},function errorCallback(response) {      console.log(response); });