Skip to content

Per request allow_redirects=False is ignored when client is initialized with allow_redirects=True #267

@oussama-gourari

Description

@oussama-gourari

Describe the bug
When the client is initialized with allow_redirects=True, the per request allow_redirects=False is ignored.

To Reproduce
Code to reproduce:

#!/usr/bin/env python
# /// script
# requires-python = ">=3.13"
# dependencies = [
#     "rnet",
# ]
# ///
from rnet import BlockingClient


client = BlockingClient(
    allow_redirects=True,
    timeout=10,
)
response = client.get(
    "https://httpbin.org//redirect-to?url=https://google.com",
    allow_redirects=False,
)
print(response.status_code, response.url)

Output:

200 https://www.google.com/

Expected output

302 https://httpbin.org//redirect-to?url=https://google.com

Environment
OS: Manjaro Linux x86_64 Gnome 48
uv: 0.7.17
Python: cpython-3.13.5-linux-x86_64-gnu
rnet: 2.4.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions