Skip to content
This repository has been archived by the owner on Nov 5, 2018. It is now read-only.

Commit

Permalink
Loop for request headers now runs correctly, added a case in tests/op…
Browse files Browse the repository at this point in the history
…ts/headers to make sure they are really getting applied. Lowercased EVERYTHING :) (hope)
  • Loading branch information
streunerlein committed May 29, 2012
1 parent 0a9bd64 commit e1836a7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
4 changes: 2 additions & 2 deletions tests/fixtures/opts/headers.json
Expand Up @@ -13,8 +13,8 @@
, { "path" : "/opts_headers/new/att"
, "status" : 304
, "response" : ""
, "reqHeaders" : {
"If-None-Match": "1-5142a2e74e1ec33e6e5b621418210283"
, "reqheaders" : {
"If-None-Match": "\"1-5142a2e74e1ec33e6e5b621418210283\""
}
}
, { "path" : "/opts_headers/new/att"
Expand Down
8 changes: 4 additions & 4 deletions tests/helpers.js
Expand Up @@ -62,7 +62,7 @@ helpers.nock = function helpersNock(url, fixture) {
? new Buffer(n.buffer, 'base64')
: n.response || ""
, headers = n.headers || {}
, reqHeaders = n.reqHeaders || {}
, reqheaders = n.reqheaders || {}
, body = n.base64
? new Buffer(n.base64, 'base64').toString()
: n.body || ""
Expand All @@ -82,9 +82,9 @@ helpers.nock = function helpersNock(url, fixture) {
});
b = "*";
}
if(reqHeaders==={}) {
for (var k in reqHeaders) {
n = n.matchHeader(k, reqHeaders[k]);
if(reqheaders!=={}) {
for (var k in reqheaders) {
n = n.matchHeader(k, reqheaders[k]);
}
}

Expand Down
9 changes: 9 additions & 0 deletions tests/opts/headers.js
Expand Up @@ -35,6 +35,15 @@ specify("opts_headers:test", timeout, function (assert) {
assert.equal(error, undefined, "Should get the hello");
assert.equal(rh["status-code"], 304, "status is 'not modified'");
});
nano.request({
db: "opts_headers",
doc: "new",
att: "att"
},
function (error, helloWorld, rh) {
assert.equal(error, undefined, "Should get the hello");
assert.equal(rh["status-code"], 200, "status is 'ok'");
});
});
});

Expand Down

0 comments on commit e1836a7

Please sign in to comment.