Skip to content

bug: strings not accepted in files param #1897

Discussion options

You must be logged in to vote

So... content there needs to be bytes - the annotation is derived from here... https://github.com/encode/httpx/blob/master/httpx/_types.py#L84-L93

FileContent = Union[IO[bytes], bytes]
FileTypes = Union[
    # file (or text)
    FileContent,
    # (filename, file (or text))
    Tuple[Optional[str], FileContent],
    # (filename, file (or text), content_type)
    Tuple[Optional[str], FileContent, Optional[str]],
]
RequestFiles = Union[Mapping[str, FileTypes], Sequence[Tuple[str, FileTypes]]]

Those comments look like they need updating tho'. They're not in line with what FileContent actually accepts.

We switched from accepting text-or-bytes to bytes-only here.
We could feasibly reconsider t…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@adriangb
Comment options

adriangb Oct 15, 2021
Collaborator Author

Answer selected by adriangb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants