alphagov/cdn-acceptance-tests — pull request #106 by dcarley (2014-09-26 13:48:52+00:00)
Title: Add tests for content manipulation

Verify that the CDN is not manipulating response bodies such as code
minification or optimisation, lossy or lossless image compression, stripping
image metadata, etc. We do not want this to happen magically, we'd rather do
it ourselves.

CloudFlare are the only vendor that we currently use who support this
option. I've tested these by flipping the appropriate switches and getting
test failures. Although I couldn't get any of the image tests to fail - even
if I used a large and more colourful image. Unsure whether that's an issue.

We need to explicitly set the `Content-Type` response header because
`http.DetectContentType()`, which normally does this automatically, detects
CSS and Javascript as generic `text/plain`. This can cause them to not be
minified.

It wouldn't be useful to display the response bodies in the error message
because they are big and binary. But I've added an error that shows the body
sizes, if they are different, to help debugging.