drewzboto / grunt-connect-proxy

Grunt Connect support for proxying API calls during development
MIT License
424 stars 122 forks source link

should it be possible to make a post request to foo.dev running on apache2 #58

Closed rich66 closed 10 years ago

rich66 commented 10 years ago

I try to make a post request and all works fine, the route is accessed, but the $_POST in php stays empty

from angularJS $http.post("/api", {"foo":"bar"}) .success(function(data, status, headers, config) { $scope.data = data; console.log(data); }).error(function(data, status, headers, config) { $scope.status = status; });

$route3 = $r->post("/api",function() use($request){ $myarray = array('bar' => 'foo','foo' =>'bas'); // test to see if response can actually return something $post = $request->request->all(); is parameterBag from Symfony if (count($_POST) == 0) { // raw post array throw new Exception("Error Processing ". print_r($_POST,true), 1);

} return new JasonResponse($_POST);

rich66 commented 10 years ago

I solved it myself. The problem was within php.I needed to check for the header application/json