[api/paramAsBody] support sending params as named json properties

This commit is contained in:
spalger
2017-02-14 18:22:13 -07:00
parent 6835cf5712
commit 8c7a25f466
2 changed files with 15 additions and 3 deletions

View File

@ -255,7 +255,13 @@ function exec(transport, spec, params, cb) {
}
if (!params.body && spec.paramAsBody) {
params.body = params[spec.paramAsBody];
if (typeof spec.paramAsBody === 'object') {
params.body = {};
params.body[spec.paramAsBody.body] = params[spec.paramAsBody.param];
} else {
params.body = params[spec.paramAsBody];
}
delete params[spec.paramAsBody];
}