Repository: getmoto/moto

Issue:
`UnicodeDecodeError` when mocking Glacier Vault's `upload_archive`
### Problem
I am trying to mock a call to Glacier Vault object's `upload_archive` method. 
What I am trying to archive is a gzip file as `bytes`.
When mocking, I get `UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte`, while archiving the **same** object to an actual Glacier Vault archives successfully.

### Code to reproduce

```python
filename = <actual gzip file>
with open(filename, "rb") as archive:
    content = archive.read()
    print(f"Content is: {content}")

    glacier = boto3.resource("glacier", region_name=<region name>)
    res = glacier.Vault("-", "<vault name>).upload_archive(body=content)
    print(f"Success: {res}")

    with mock_glacier():
        glacier = boto3.resource("glacier", region_name=<region name>)
        res = glacier.Vault("-", "<vault name>).upload_archive(body=content)
``` 

### Error trace: 
```
Content is: b'\x1f\x8b\x08\x08\t\xe3\xe6a\x00\x03log_file.txt\x00s\xce\xcf+I\xcd+\xe1\x02\x00\xb9\xbaUd\x08\x00\x00\x00'

Success: glacier.Archive(account_id='-', vault_name='com.diabeloop.dev.vault.technical-logs', id='diXolDWTXV3RcAiGxA-RyzMYRYqV9g7laUpnMvrRr5SHkKyIxoXHqN5w4PxXWPLwd90mFmJ-LkxqYgZxqAFvu3He87liBKWS6euNtim-I0KARLEbedLPumlcql9hx2ZEqpIehXHKNw')

Traceback (most recent call last):
  File "mvp.py", line 18, in <module>
    glacier.Vault("-", "<vault name>").upload_archive(body=content)
  File "~/.venv/lib/python3.7/site-packages/boto3/resources/factory.py", line 520, in do_action
    response = action(self, *args, **kwargs)
  File "~/.venv/lib/python3.7/site-packages/boto3/resources/action.py", line 83, in __call__
    response = getattr(parent.meta.client, operation_name)(*args, **params)
  File "~/.venv/lib/python3.7/site-packages/botocore/client.py", line 386, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "~/.venv/lib/python3.7/site-packages/botocore/client.py", line 692, in _make_api_call
    operation_model, request_dict, request_context)
  File "~/.venv/lib/python3.7/site-packages/botocore/client.py", line 711, in _make_request
    return self._endpoint.make_request(operation_model, request_dict)
  File "~/.venv/lib/python3.7/site-packages/botocore/endpoint.py", line 102, in make_request
    return self._send_request(request_dict, operation_model)
  File "~/.venv/lib/python3.7/site-packages/botocore/endpoint.py", line 137, in _send_request
    success_response, exception):
  File "~/.venv/lib/python3.7/site-packages/botocore/endpoint.py", line 256, in _needs_retry
    caught_exception=caught_exception, request_dict=request_dict)
  File "~/.venv/lib/python3.7/site-packages/botocore/hooks.py", line 356, in emit
    return self._emitter.emit(aliased_event_name, **kwargs)
  File "~/.venv/lib/python3.7/site-packages/botocore/hooks.py", line 228, in emit
    return self._emit(event_name, kwargs)
  File "~/.venv/lib/python3.7/site-packages/botocore/hooks.py", line 211, in _emit
    response = handler(**kwargs)
  File "~/.venv/lib/python3.7/site-packages/botocore/retryhandler.py", line 183, in __call__
    if self._checker(attempts, response, caught_exception):
  File "~/.venv/lib/python3.7/site-packages/botocore/retryhandler.py", line 251, in __call__
    caught_exception)
  File "~/.venv/lib/python3.7/site-packages/botocore/retryhandler.py", line 269, in _should_retry
    return self._checker(attempt_number, response, caught_exception)
  File "~/.venv/lib/python3.7/site-packages/botocore/retryhandler.py", line 317, in __call__
    caught_exception)
  File "~/.venv/lib/python3.7/site-packages/botocore/retryhandler.py", line 223, in __call__
    attempt_number, caught_exception)
  File "~/.venv/lib/python3.7/site-packages/botocore/retryhandler.py", line 359, in _check_caught_exception
    raise caught_exception
  File "~/.venv/lib/python3.7/site-packages/botocore/endpoint.py", line 197, in _do_get_response
    responses = self._event_emitter.emit(event_name, request=request)
  File "~/.venv/lib/python3.7/site-packages/botocore/hooks.py", line 356, in emit
    return self._emitter.emit(aliased_event_name, **kwargs)
  File "~/.venv/lib/python3.7/site-packages/botocore/hooks.py", line 228, in emit
    return self._emit(event_name, kwargs)
  File "~/.venv/lib/python3.7/site-packages/botocore/hooks.py", line 211, in _emit
    response = handler(**kwargs)
  File "~/.venv/lib/python3.7/site-packages/moto/core/models.py", line 405, in __call__
    request, request.url, request.headers
  File "~/.venv/lib/python3.7/site-packages/moto/glacier/responses.py", line 58, in vault_archive_response
    self.setup_class(request, full_url, headers)
  File "~/.venv/lib/python3.7/site-packages/moto/core/responses.py", line 224, in setup_class
    self.body = self.body.decode("utf-8")
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte
```
-----
Thanks for moto, that really is both useful and easy to use !! ❤


Discussion:
Thanks for raising this @EnzoMolion - looks like we always expect the request body to be a string, rather than an arbitrary byte array. Marking this as a bug.

Resolving patch:
diff --git a/moto/glacier/responses.py b/moto/glacier/responses.py
--- a/moto/glacier/responses.py
+++ b/moto/glacier/responses.py
@@ -55,7 +55,6 @@ def _vault_response_delete(self, vault_name, querystring, headers):
         return 204, headers, ""
 
     def vault_archive_response(self, request, full_url, headers):
-        self.setup_class(request, full_url, headers)
         return self._vault_archive_response(request, full_url, headers)
 
     def _vault_archive_response(self, request, full_url, headers):


Test patch:
diff --git a/tests/test_glacier/test.gz b/tests/test_glacier/test.gz
new file mode 100644
Binary files /dev/null and b/tests/test_glacier/test.gz differ
diff --git a/tests/test_glacier/test_glacier_archives.py b/tests/test_glacier/test_glacier_archives.py
--- a/tests/test_glacier/test_glacier_archives.py
+++ b/tests/test_glacier/test_glacier_archives.py
@@ -1,4 +1,5 @@
 import boto3
+import os
 import sure  # noqa # pylint: disable=unused-import
 import pytest
 
@@ -23,6 +24,21 @@ def test_upload_archive():
     res.should.have.key("archiveId")
 
 
+@mock_glacier
+def test_upload_zip_archive():
+    client = boto3.client("glacier", region_name="us-west-2")
+    client.create_vault(vaultName="asdf")
+
+    path = "test.gz"
+    with open(os.path.join(os.path.dirname(__file__), path), mode="rb") as archive:
+        content = archive.read()
+
+        res = client.upload_archive(vaultName="asdf", body=content)
+
+        res["ResponseMetadata"]["HTTPStatusCode"].should.equal(201)
+        res.should.have.key("checksum")
+
+
 @mock_glacier
 def test_delete_archive():
     client = boto3.client("glacier", region_name="us-west-2")