From ccea05db365ecbc320da22a07ad6c9b01c861b95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Mon, 21 Nov 2016 11:20:07 +0100 Subject: [PATCH] Add test for cloning GET request Closes #440 --- test/test.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/test/test.js b/test/test.js index c24745d1..5b6869d5 100644 --- a/test/test.js +++ b/test/test.js @@ -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'},