diff --git a/src/bhcli/api/__init__.py b/src/bhcli/api/__init__.py index bc631ef..69b6eae 100644 --- a/src/bhcli/api/__init__.py +++ b/src/bhcli/api/__init__.py @@ -66,6 +66,8 @@ def _send(self, method, endpoint, data=None, content_type="application/json"): digester = hmac.new(digester.digest(), None, hashlib.sha256) if data is not None: if isinstance(data, io.BufferedIOBase): + # Seek to the start *before hashing, so the first attempt and any retry are retry-safe + data.seek(0) for chunk in iter(lambda: data.read(65536), b""): digester.update(chunk) data.seek(0)