From 34ad604b98924a5640d671d108a47ffc1926d321 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Sun, 21 May 2017 21:12:38 +0430 Subject: [PATCH] [Tests] ETag --- test/basic.test.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/basic.test.js b/test/basic.test.js index 6dfe898c03..201fd4447c 100755 --- a/test/basic.test.js +++ b/test/basic.test.js @@ -144,6 +144,15 @@ test('/redirect2 status code', async t => { t.true(output.stderr[0].includes('Error: NOPE!')) }) +test('ETag Header', async t => { + const {headers: {etag}} = await rp(url('/stateless'), {resolveWithFullResponse: true}) + // Validate etag + t.regex(etag, /W\/".*"$/) + // Verify functionality + const error = await t.throws(rp(url('/stateless'), { headers: {'If-None-Match': etag}})) + t.is(error.statusCode, 304) +}) + // Close server and ask nuxt to stop listening to file changes test.after('Closing server and nuxt.js', t => { server.close()