Permalink
Browse files

Add test for cloning GET request

Closes #440
1 parent b54dbac commit ccea05db365ecbc320da22a07ad6c9b01c861b95 @mislav mislav committed Nov 21, 2016
Showing with 14 additions and 1 deletion.
  1. +14 −1 test/test.js
View
@@ -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'},

0 comments on commit ccea05d

Please sign in to comment.