Skip to content

Add missing | None to auth parameter in convenience methods#3770

Open
bysiber wants to merge 1 commit intoencode:masterfrom
bysiber:fix/auth-type-annotation-consistency
Open

Add missing | None to auth parameter in convenience methods#3770
bysiber wants to merge 1 commit intoencode:masterfrom
bysiber:fix/auth-type-annotation-consistency

Conversation

@bysiber
Copy link

@bysiber bysiber commented Feb 20, 2026

The options(), head(), post(), put(), patch(), and delete() methods on both Client and AsyncClient are missing | None in their auth parameter type annotation.

This is inconsistent with get(), request(), send(), and stream() which all accept auth: AuthTypes | UseClientDefault | None.

Passing auth=None to explicitly opt out of authentication is a valid use case already supported at runtime, but the type annotations on these methods would incorrectly flag it.

The `options()`, `head()`, `post()`, `put()`, `patch()`, and
`delete()` methods on both `Client` and `AsyncClient` were missing
`| None` in their `auth` parameter type annotation. This makes them
inconsistent with `get()`, `request()`, `send()`, and `stream()`
which all accept `auth: AuthTypes | UseClientDefault | None`.

Passing `auth=None` to explicitly opt out of authentication is a
valid use case that was already supported at runtime (via `request()`)
but the type annotations on these methods would incorrectly flag it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments