-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add support for getSetCookie() method on fetch response headers objects.
Fixes #56 Relates to whatwg/fetch#1346
- Loading branch information
Showing
3 changed files
with
59 additions
and
23 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
"use strict"; | ||
var assert = require("assert"); | ||
var setCookie = require("../lib/set-cookie.js"); | ||
|
||
describe("fetch", () => { | ||
before(() => { | ||
// conditionall skip these tests if the environment doesn't support the necessary features | ||
if ( | ||
typeof fetch !== "undefined" && | ||
typeof Response !== "undefined" && | ||
typeof new Response().headers.getSetCookie !== "function" | ||
) { | ||
this.skip(); | ||
} | ||
}); | ||
|
||
it("should use getSetCookie method on a Response object", () => { | ||
const fakeResponse = { | ||
headers: { | ||
getSetCookie: () => ["foo=bar"], | ||
}, | ||
}; | ||
|
||
var actual = setCookie.parse(fakeResponse); | ||
var expected = [{ name: "foo", value: "bar" }]; | ||
assert.deepEqual(actual, expected); | ||
}); | ||
}); |