-
Notifications
You must be signed in to change notification settings - Fork 56
Open
Labels
Description
It would be nice to have an auth pattern. I'm writing an app using a Basic auth protected API and I want to test the calls. Right now, I need to do this:
respx.post(
"https://example.com/",
headers={"Authorization": "Basic " + b64encode(b"rimmer:Gazpacho!").decode()},
).mock(...)This works, but is quite ugly and I'd prefer to have a direct auth pattern:
respx.post(
"https://example.com/",
auth=("rimmer", "Gazpacho!"),
).mock(...)This would mimick the auth argument of httpx.request(), similarly to json and similar patterns.
Note: httpx also supports Digest authentication, so respx should probably also cover that usecase, if implemented.
Reactions are currently unavailable