Using AngularJS + Express I have the following code to proxy my requests to a remote service:
app.get('/api.json', function (req, res) {
req.pipe(request("http://test-api.com/api.json")).pipe(res);
});
app.post('/api.json', function (req, res) {
req.pipe(request.post("http://test-api.com/api.json")).pipe(res);
});
All GET requests works fine, however the POST requests are pending in my browser.
Here is how I post:
$http({
method: 'POST',
url: '/api.json',
data: $.param({
"title": not.title,
"desc": not.description
}), // pass in data as strings
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
}).success(function () {alert("Success");});
What's wrong?
EDIT: Here is the request as seen on the console:
What should I check to give more information?
See Question&Answers more detail:os