Skip to content

Commit

Permalink
Add test for cloning GET request
Browse files Browse the repository at this point in the history
Closes #440
  • Loading branch information
mislav committed Nov 21, 2016
1 parent b54dbac commit ccea05d
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion test/test.js
Expand Up @@ -433,7 +433,20 @@ suite('Request', function() {
assert.equal(req.headers.get('content-type'), 'image/png')
})

test('clone request', function() {
test('clone GET request', function() {
var req = new Request('https://fetch.spec.whatwg.org/', {
headers: {'content-type': 'text/plain'}
})
var clone = req.clone()

assert.equal(clone.url, req.url)
assert.equal(clone.method, 'GET')
assert.equal(clone.headers.get('content-type'), 'text/plain')
assert.notEqual(clone.headers, req.headers)
assert.isFalse(req.bodyUsed)
})

test('clone POST request', function() {
var req = new Request('https://fetch.spec.whatwg.org/', {
method: 'post',
headers: {'content-type': 'text/plain'},
Expand Down

0 comments on commit ccea05d

Please sign in to comment.