Comparing version 1.1.0 to 1.1.1
@@ -597,28 +597,29 @@ // -------------------------------------------------------------------------------------------------------------------- | ||
// build the body from either options.form, options.json or using operation.body | ||
// build the body from either options.form, options.json or using operation.body | ||
if ( operation.body ) { | ||
if ( typeof operation.body === 'string' ) { | ||
options.body = operation.body; | ||
// if we already have a body, just use it, or build the body from either options.form, | ||
// options.json or using operation.body | ||
if ( !options.body ) { | ||
if ( operation.body ) { | ||
if ( typeof operation.body === 'string' ) { | ||
options.body = operation.body; | ||
} | ||
else if ( typeof operation.body === 'function' ) { | ||
options.body = operation.body.apply(self, [ options, args ]); | ||
} | ||
else { | ||
// since this is a program error, we're gonna throw this one | ||
throw 'Unknown operation.body : ' + typeof operation.body; | ||
} | ||
} else if ( options.forms && options.forms.length ) { | ||
var formParts = []; | ||
options.forms.forEach(function(v, i) { | ||
formParts[i] = v.name + "=" + escape(v.value); | ||
}); | ||
options.body = formParts.join("&"); | ||
options.headers['content-type'] = 'application/x-www-form-urlencoded'; | ||
} else { | ||
options.body = JSON.stringify(options.json); | ||
if ( options.body === '{}' ) { | ||
options.body = undefined; | ||
} | ||
} | ||
else if ( typeof operation.body === 'function' ) { | ||
options.body = operation.body.apply(self, [ options, args ]); | ||
} | ||
else { | ||
// since this is a program error, we're gonna throw this one | ||
throw 'Unknown operation.body : ' + typeof operation.body; | ||
} | ||
} else if ( options.forms && options.forms.length ) { | ||
var formParts = []; | ||
options.forms.forEach(function(v, i) { | ||
formParts[i] = v.name + "=" + escape(v.value); | ||
}); | ||
options.body = formParts.join("&"); | ||
options.headers['content-type'] = 'application/x-www-form-urlencoded'; | ||
} else { | ||
options.body = JSON.stringify(options.json); | ||
if ( options.body === '{}' ) { | ||
options.body = undefined; | ||
} | ||
} | ||
@@ -625,0 +626,0 @@ |
{ | ||
"name" : "awssum", | ||
"description" : "NodeJS module to aid talking to Web Service APIs. Requires plugins.", | ||
"version" : "1.1.0", | ||
"version" : "1.1.1", | ||
@@ -21,3 +21,3 @@ "main" : "awssum.js", | ||
"homepage" : "https://awssum.io/", | ||
"homepage" : "http://awssum.io/", | ||
"repository" : { | ||
@@ -28,3 +28,3 @@ "type" : "git", | ||
"bugs" : { | ||
"url" : "http://github.com/awssum/awssum/issues", | ||
"url" : "https://github.com/awssum/awssum/issues", | ||
"email" : "andychilton@gmail.com" | ||
@@ -41,3 +41,3 @@ }, | ||
"type" : "MIT", | ||
"url" : "http://github.com/appsattic/node-awssum/raw/master/LICENSE" | ||
"url" : "https://github.com/appsattic/node-awssum/raw/master/LICENSE" | ||
}], | ||
@@ -44,0 +44,0 @@ "keywords" : [ |
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
68635
1418