Skip to content

Commit

Permalink
fix(files): remove content_length argument
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertCraigie committed Jul 12, 2024
1 parent 269d7e5 commit 9a57374
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
11 changes: 2 additions & 9 deletions src/writerai/resources/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,9 @@

import httpx

from ..types import file_list_params, file_upload_params
from ..types import file_list_params
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven, FileTypes
from .._utils import (
maybe_transform,
async_maybe_transform,
)
from .._utils import maybe_transform
from .._compat import cached_property
from .._resource import SyncAPIResource, AsyncAPIResource
from .._response import (
Expand Down Expand Up @@ -199,7 +196,6 @@ def upload(
*,
content: FileTypes,
content_disposition: str,
content_length: int,
content_type: str,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
Expand All @@ -222,7 +218,6 @@ def upload(
"""
extra_headers = {
"Content-Disposition": content_disposition,
"Content-Length": str(content_length),
"Content-Type": content_type,
**(extra_headers or {}),
}
Expand Down Expand Up @@ -399,7 +394,6 @@ async def upload(
*,
content: FileTypes,
content_disposition: str,
content_length: int,
content_type: str,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
Expand All @@ -422,7 +416,6 @@ async def upload(
"""
extra_headers = {
"Content-Disposition": content_disposition,
"Content-Length": str(content_length),
"Content-Type": content_type,
**(extra_headers or {}),
}
Expand Down
6 changes: 0 additions & 6 deletions tests/api_resources/test_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ def test_method_upload(self, client: Writer) -> None:
file = client.files.upload(
content=b"raw file contents",
content_disposition="Content-Disposition",
content_length=0,
content_type="Content-Type",
)
assert_matches_type(File, file, path=["response"])
Expand All @@ -209,7 +208,6 @@ def test_raw_response_upload(self, client: Writer) -> None:
response = client.files.with_raw_response.upload(
content=b"raw file contents",
content_disposition="Content-Disposition",
content_length=0,
content_type="Content-Type",
)

Expand All @@ -224,7 +222,6 @@ def test_streaming_response_upload(self, client: Writer) -> None:
with client.files.with_streaming_response.upload(
content=b"raw file contents",
content_disposition="Content-Disposition",
content_length=0,
content_type="Content-Type",
) as response:
assert not response.is_closed
Expand Down Expand Up @@ -411,7 +408,6 @@ async def test_method_upload(self, async_client: AsyncWriter) -> None:
file = await async_client.files.upload(
content=b"raw file contents",
content_disposition="Content-Disposition",
content_length=0,
content_type="Content-Type",
)
assert_matches_type(File, file, path=["response"])
Expand All @@ -422,7 +418,6 @@ async def test_raw_response_upload(self, async_client: AsyncWriter) -> None:
response = await async_client.files.with_raw_response.upload(
content=b"raw file contents",
content_disposition="Content-Disposition",
content_length=0,
content_type="Content-Type",
)

Expand All @@ -437,7 +432,6 @@ async def test_streaming_response_upload(self, async_client: AsyncWriter) -> Non
async with async_client.files.with_streaming_response.upload(
content=b"raw file contents",
content_disposition="Content-Disposition",
content_length=0,
content_type="Content-Type",
) as response:
assert not response.is_closed
Expand Down

0 comments on commit 9a57374

Please sign in to comment.