|
8 | 8 |
|
9 | 9 | from ..constants import DEFAULT_FILE_OPTIONS, DEFAULT_SEARCH_OPTIONS |
10 | 10 | from ..types import BaseBucket, ListBucketFilesOptions, RequestMethod |
11 | | -from ..utils import StorageException, SyncClient |
| 11 | +from ..utils import SyncClient, StorageException |
12 | 12 |
|
13 | 13 | __all__ = ["SyncBucket"] |
14 | 14 |
|
@@ -126,9 +126,8 @@ def list( |
126 | 126 | Search options, including `limit`, `offset`, and `sortBy`. |
127 | 127 | """ |
128 | 128 | extra_options = options or {} |
129 | | - body = dict(DEFAULT_SEARCH_OPTIONS, **extra_options) |
130 | 129 | extra_headers = {"Content-Type": "application/json"} |
131 | | - body["prefix"] = path or "" |
| 130 | + body = {**DEFAULT_SEARCH_OPTIONS, **extra_options, "prefix": path or ""} |
132 | 131 | response = self._request( |
133 | 132 | "POST", |
134 | 133 | f"/object/list/{self.id}", |
@@ -167,13 +166,13 @@ def upload( |
167 | 166 | file |
168 | 167 | The File object to be stored in the bucket. or a async generator of chunks |
169 | 168 | file_options |
170 | | - HTTP headers. For example `cacheControl` |
| 169 | + HTTP headers. For example `cache-control` |
171 | 170 | """ |
172 | 171 | if file_options is None: |
173 | 172 | file_options = {} |
174 | | - headers = dict(self._client.headers, **DEFAULT_FILE_OPTIONS, **file_options) |
| 173 | + headers = {**self._client.headers, **DEFAULT_FILE_OPTIONS, **file_options} |
175 | 174 | filename = path.rsplit("/", maxsplit=1)[-1] |
176 | | - files = {"file": (filename, open(file, "rb"), headers["contentType"])} |
| 175 | + files = {"file": (filename, open(file, "rb"), headers.pop("content-type"))} |
177 | 176 | _path = self._get_final_path(path) |
178 | 177 |
|
179 | 178 | return self._request( |
|
0 commit comments