Created
August 13, 2011 17:31
-
-
Save Raynos/1144061 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
r = require("request").defaults({ | |
"json": true, | |
"headers": { | |
"Authorization": "Basic " + new Buffer(process.env.COUCH_USER + ":" + process.env.COUCH_PWD).toString("base64") | |
} | |
}), | |
var base_url = "http://raynos.iriscouch.com/raynos" | |
// data is an Object | |
r({ | |
"uri": base_url, | |
"body": data, | |
"method": "POST" | |
}, error(function(err, resp, body) { | |
console.log(body); | |
})); | |
// returns | |
{ | |
error: 'bad_request', | |
reason: 'Document must be a JSON object' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment