couchdb-resp-completer
Advanced tools
Comparing version 1.0.0 to 1.0.1
13
index.js
@@ -31,3 +31,3 @@ /* | ||
if (Object.prototype.toString.call(resp) !== "[object Object]") { | ||
resp = {body: ""}; | ||
resp = {}; | ||
} | ||
@@ -61,7 +61,7 @@ //check for keys that shouldn't be in the resp object | ||
resp.headers["Content-Type"] = resp.headers["Content-Type"] || contentType; | ||
if (resp.json) { | ||
if (typeof resp.json !== 'undefined') { | ||
resp.body = JSON.stringify(resp.json); | ||
resp.headers["Content-Type"] = resp.headers["Content-Type"] || "application/json"; | ||
} | ||
if (resp.base64) { | ||
if (typeof resp.base64 !== 'undefined') { | ||
resp.headers["Content-Type"] = resp.headers["Content-Type"] || "application/binary"; | ||
@@ -72,3 +72,10 @@ } | ||
//the user isn't allowed to set the etag header | ||
delete resp.headers.Etag; | ||
if (typeof resp.body === "undefined" && typeof resp.base64 === "undefined") { | ||
resp.body = ""; | ||
} | ||
return resp; | ||
}; |
{ | ||
"name": "couchdb-resp-completer", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"main": "index.js", | ||
@@ -5,0 +5,0 @@ "description": "Builds a complete CouchDB-like response object from a very marginal one. (Can be just a string at first.)", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3518
68