aristidb / aws

Amazon Web Services for Haskell
BSD 3-Clause "New" or "Revised" License
239 stars 108 forks source link

Add ETag fields to get/head object #194

Closed MichaelXavier closed 8 years ago

MichaelXavier commented 8 years ago

These fields are used to conditionally download or head files in S3 when you know the MD5 checksum (e.g. if you have a local copy and want to avoid a redownload). If-None-Match will throw a 304 not modified status error if the etag matches. Conversely, If-Match will throw a 412 precondition failed if the etag does not match. Both of these cases are tested for and documented in the field haddocks.

As a side note, I needed to borrow some status handling code from HeadObject for GetObject. It was very important to get a consistent type of exception to catch when using these ETag headers because the user will usually be explicitly catching those errors.

I've run the tests locally and they pass. In order to run them for yourself you'll need to run it with --run-with-aws-credentials --bucket some-bucket-the-test-can-use.

aristidb commented 8 years ago

I like that we have at least some automated S3 tests now, thanks!