提交 e1939480 编写于 作者: J Joshua Peek

Merge branch 'master' of https://github.com/nikhilm/fetch into nikhilm-master

......@@ -98,7 +98,7 @@ var routes = {
'/cookie': function(res, req) {
var setCookie, cookie
var params = querystring.parse(url.parse(req.url).query);
if (params.value && params.value) {
if (params.name && params.value) {
setCookie = [params.name, params.value].join('=');
}
if (params.name) {
......
......@@ -451,14 +451,38 @@ suite('Atomic HTTP redirect handling', function() {
suite('credentials mode', function() {
var omitSupported = !self.fetch.polyfill
setup(function() {
return fetch('/cookie?name=foo&value=reset', {credentials: 'same-origin'});
})
;(omitSupported ? suite : suite.skip)('omit', function() {
test('request credentials defaults to omit', function() {
var request = new Request('')
assert.equal(request.credentials, 'omit')
})
test('does not send cookies with implicit omit credentials', function() {
test('does not accept cookies with implicit omit credentials', function() {
return fetch('/cookie?name=foo&value=bar').then(function() {
return fetch('/cookie?name=foo', {credentials: 'same-origin'});
}).then(function(response) {
return response.text()
}).then(function(data) {
assert.equal(data, 'reset')
})
})
test('does not accept cookies with omit credentials', function() {
return fetch('/cookie?name=foo&value=bar', {credentials: 'omit'}).then(function() {
return fetch('/cookie?name=foo', {credentials: 'same-origin'});
}).then(function(response) {
return response.text()
}).then(function(data) {
assert.equal(data, 'reset')
})
})
test('does not send cookies with implicit omit credentials', function() {
return fetch('/cookie?name=foo&value=bar', {credentials: 'same-origin'}).then(function() {
return fetch('/cookie?name=foo');
}).then(function(response) {
return response.text()
......@@ -485,7 +509,7 @@ suite('credentials mode', function() {
})
test('send cookies with same-origin credentials', function() {
return fetch('/cookie?name=foo&value=bar').then(function() {
return fetch('/cookie?name=foo&value=bar', {credentials: 'same-origin'}).then(function() {
return fetch('/cookie?name=foo', {credentials: 'same-origin'})
}).then(function(response) {
return response.text()
......@@ -497,7 +521,7 @@ suite('credentials mode', function() {
suite('include', function() {
test('send cookies with include credentials', function() {
return fetch('/cookie?name=foo&value=bar').then(function() {
return fetch('/cookie?name=foo&value=bar', {credentials: 'include'}).then(function() {
return fetch('/cookie?name=foo', {credentials: 'include'})
}).then(function(response) {
return response.text()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册