alphagov/cdn-acceptance-tests — pull request #108 by dcarley (2014-10-01 08:26:18+00:00)
Title: Improve TestNoManipulation*

#### Use mime.TypeByExtension for fixture Content-Type

DRYs up the tests significantly. This doesn't suffer from the same problems
as http.DetectContentType described in 40048ca whereby it would detect JS
and CSS as generic `text/plain`.

The builtin map works sufficiently on OS X which doesn't have
`/etc/mime.types` to supplement it. Although, just to be safe, I have added
an additional check to make sure that we don't get an empty or generic type.

Thanks to @mattbostock for indirectly finding this.

#### Set req.URL.Path in testResponseNotManipulated

To give the CDN some additional help in determining the type. The
`Content-Type` header should be sufficient, but we can't get the image tests
to fail on CloudFlare when the right boxes are ticked and we've noticed that
they sometimes care more about file extensions than content.

This won't affect the random UUID that forms part of the request as a query
param because they exist in a different `req.URL` field.