partial support for twilio urlencoded parser
This commit is contained in:
parent
bd497902f0
commit
891489e359
30
lib/apis.js
30
lib/apis.js
|
@ -430,20 +430,30 @@ module.exports.create = function (xconfx, apiFactories, apiDeps) {
|
|||
}
|
||||
});
|
||||
|
||||
var caps = {
|
||||
'com.daplie.tel.twilio': function (/*opts*/) {
|
||||
if (_twilio) {
|
||||
return _twilio;
|
||||
}
|
||||
function twilioTel(/*opts*/) {
|
||||
if (_twilio) {
|
||||
return _twilio;
|
||||
}
|
||||
|
||||
var Twilio = require('twilio');
|
||||
_twilio = new Twilio.RestClient(siteConfig['twilio.com'].id, siteConfig['twilio.com'].auth);
|
||||
return apiDeps.Promise.resolve(_twilio);
|
||||
var Twilio = require('twilio');
|
||||
_twilio = new Twilio.RestClient(
|
||||
siteConfig['twilio.com'].live.id
|
||||
, siteConfig['twilio.com'].live.auth
|
||||
);
|
||||
return apiDeps.Promise.resolve(_twilio);
|
||||
}
|
||||
|
||||
var bodyParserTwilio = require('body-parser').urlencoded({ limit: '4kb', parameterLimit: 25, extended: false });
|
||||
var caps = {
|
||||
'twilio@daplie.com': twilioTel
|
||||
, 'com.daplie.tel.twilio': twilioTel // deprecated
|
||||
, 'twilio.urlencoded@daplie.com': function (req, res, next) {
|
||||
return bodyParserTwilio(req, res, next);
|
||||
}
|
||||
};
|
||||
req.getSiteCapability = function (capname, opts) {
|
||||
req.getSiteCapability = function (capname, opts, b, c) {
|
||||
if (caps[capname]) {
|
||||
return caps[capname](opts);
|
||||
return caps[capname](opts, b, c);
|
||||
}
|
||||
return apiDeps.Promise.reject(
|
||||
new Error("['" + req.clientApiUri + '/' + pkgId + "'] "
|
||||
|
|
Loading…
Reference in New Issue