change api calls from POST to GET

This commit is contained in:
Peter 'Pita' Martischka 2011-08-08 20:14:01 +01:00
parent 9d91a3873c
commit a6df6ab0a7
1 changed files with 12 additions and 26 deletions

View File

@ -243,18 +243,11 @@ async.waterfall([
var apiLogger = log4js.getLogger("API");
//This is a api call, collect all post informations and pass it to the apiHandler
app.all('/api/1/:func', function(req, res)
app.get('/api/1/:func', function(req, res)
{
res.header("Server", serverName);
//check if this is a post request
if(req.method == "POST")
{
new formidable.IncomingForm().parse(req, function(err, fields, files)
{
if(err) throw err;
apiLogger.info("REQUEST, " + req.params.func + ", " + JSON.stringify(fields));
apiLogger.info("REQUEST, " + req.params.func + ", " + JSON.stringify(req.query));
//wrap the send function so we can log the response
res._send = res.send;
@ -266,14 +259,7 @@ async.waterfall([
}
//call the api handler
apiHandler.handle(req.params.func, fields, req, res);
});
}
//say goodbye if this is not a post request
else
{
res.send({code: 5, message: "no POST request", data: null});
}
apiHandler.handle(req.params.func, req.query, req, res);
});
//The Etherpad client side sends information about how a disconnect happen