Permalink
Browse files

Added ability to talk to Couch on a subpath, added content-length for…

… routing through nginx proxy
  • Loading branch information...
1 parent b4f2eba commit 3bdf7e741de8b667ba4820555ffc4597a3af0293 @DamonOehlman DamonOehlman committed Aug 11, 2011
Showing with 5 additions and 1 deletion.
  1. +5 −1 lib/PJsonCouch.js
View
@@ -156,6 +156,10 @@ var Utils = {
request: function (reqOptions, data, reqConfig, callBackFunction) {
var result = "";
data = data || "";
+
+ // add the content length header
+ reqOptions.headers['Content-Length'] = data.length;
+
var req = http.request(reqOptions, function (res) {
(reqOptions.resultEncoding) ? res.setEncoding(reqOptions.resultEncoding) : res.setEncoding('utf8');
res.on('data', function (chunk) {
@@ -532,7 +536,7 @@ var PJsonCouch = function (options) {
reqOpts.path += Utils.decodeGetData(url);
reqOpts.method = method;
- reqOpts.path = (qsparams === "") ? options.path : options.path + "?" + qsparams;
+ reqOpts.path = (qsparams === "") ? reqOpts.path : reqOpts.path + "?" + qsparams;
if (method !== "GET") {
reqOpts.headers["Content-Type"] = "application/json";

0 comments on commit 3bdf7e7

Please sign in to comment.