findify / s3mock

Embedded S3 server for easy mocking
MIT License
387 stars 107 forks source link

setting responseContentEncoding on the GetObjectRequest is not respected by response #114

Open apple-corps opened 6 years ago

apple-corps commented 6 years ago

If I set responseContentEncoding("gzip") and make a request, the response has the expected contentEncoding: gzip against a real S3 api.

However doing the same against s3mock , the response has null contentEncoding.

using V2 of client API E.G. software.amazon.awssdk

 def getGzipByteArray(client: S3Client, bucket: String, key: String): Array[Byte] = {
    val response = client.getObjectBytes(getGzipObjectRequest(bucket,key))
      println (response.response().contentEncoding())
      response.asByteArray()
  }

  def getGzipObjectRequest(bucket: String ,key : String ) = {
    GetObjectRequest.builder()
      .responseContentEncoding("gzip")
      .responseContentType("application/octet-stream")
      .bucket(bucket)
      .key(key)
      .build()
  }