Skip to content

Commit

Permalink
test(test/e2e/cli-test.coffee): More fully disable HTTP caching in re…
Browse files Browse the repository at this point in the history
…sponse

Original code applied only to HTTP/1.1. Added two additional headers to handle HTTP/1.0, as well as
proxies.
  • Loading branch information
plroebuck committed Apr 9, 2018
1 parent 5ab8fe7 commit 97f7029
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion test/e2e/cli-test.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,8 @@ describe 'Command line interface', () ->
res.setHeader 'Allow', allow.join ','
disableCache = ['no-cache', 'no-store', 'must-revalidate']
res.setHeader 'Cache-Control', disableCache.join ','
res.setHeader 'Pragma', disableCache[0]
res.setHeader 'Expires', '0'
res.status(204).end()
next()

Expand All @@ -405,7 +407,9 @@ describe 'Command line interface', () ->
if req.method == 'OPTIONS'
return [
'Allow',
'Cache-Control'
'Cache-Control',
'Expires',
'Pragma'
]
else
return [
Expand Down Expand Up @@ -452,6 +456,10 @@ describe 'Command line interface', () ->
it 'OPTIONS response should disable caching of it', () ->
cacheControl = optionsResponse.headers['Cache-Control']
expect(cacheControl).to.equal('no-cache,no-store,must-revalidate')
pragma = optionsResponse.headers['Pragma']
expect(pragma).to.equal('no-cache')
expires = optionsResponse.headers['Expires']
expect(expires).to.equal('0')

it 'OPTIONS and HEAD responses should not have bodies', () ->
expect(optionsResponse.body).to.be.empty
Expand Down

0 comments on commit 97f7029

Please sign in to comment.