Permalink
Browse files

Tweaked options initialization

  • Loading branch information...
1 parent 8297094 commit af7f5939c8c07ca8bf2721392b35879a69727aa9 @DamonOehlman DamonOehlman committed Aug 10, 2011
Showing with 4 additions and 5 deletions.
  1. +4 −5 lib/PJsonCouch.js
View
@@ -193,6 +193,9 @@ var Utils = {
var PJsonCouch = function (options) {
+
+ // initialise options defaults
+ options.headers = options.headers || {};
if (this instanceof PJsonCouch) {
@@ -526,16 +529,12 @@ var PJsonCouch = function (options) {
options.path = Utils.decodeGetData(url);
options.method = method;
options.path = (qsparams === "") ? options.path : options.path + "?" + qsparams;
- if (options.headers === undefined) {
- options.headers = {};
- }
+
if (method !== "GET") {
options.headers["Content-Type"] = "application/json";
}
-
if (mySession !== "") {
-
options.headers["Cookie"] = "AuthSession=" + mySession;
}

0 comments on commit af7f593

Please sign in to comment.