[Bug] Redirects not being followed
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 55/100
Research direction
Start by comparing the redirect handling around commit d9180bb and the client options used by GraphClientFactory.create_with_default_middleware. Reproduce the Microsoft Graph driveItem content request, trace why the 302 Location response is not followed despite RedirectHandlerOption, and verify that redirects are followed again with a regression test.
Written by the indexing model from the issue text.
Description
A bug has been introduced in version 1.13.0 of microsoft-kiota-http: redirects aren't being followed correctly.
For example, to download a driveItem from the MS Graph API (docs link) you make a call to /drives/{drive-id}/items/{item-id}/content and get back an empty 302 Found response with the Location header set to the actual download URL.
The below is an extract of the httpx logs from version 1.13.0. You can see the Location header is successfully returned, but no redirect is made.
DEBUG [2026-09-21 08:53:37] httpcore.http11 - send_request_headers.started request=<Request [b'GET']>
DEBUG [2026-09-21 08:53:37] httpcore.http11 - send_request_headers.complete
DEBUG [2026-09-21 08:53:37] httpcore.http11 - send_request_body.started request=<Request [b'GET']>
DEBUG [2026-09-21 08:53:37] httpcore.http11 - send_request_body.complete
DEBUG [2026-09-21 08:53:37] httpcore.http11 - receive_response_headers.started request=<Request [b'GET']>
DEBUG [2026-09-21 08:53:37] httpcore.http11 - receive_response_headers.complete return_value=(b'HTTP/1.1', 302, b'Found', [(b'Cache-Control', b'no-store, no-cache'), (b'Content-Type', b'application/octet-stream'), (b'Location', b'<link to the download location>'), (b'Strict-Transport-Security', b'max-age=31536000'), (b'request-id', b'44de6ff3-71fc-42e6-ad10-9670be4fcb0d'), (b'client-request-id', b'44de6ff3-71fc-42e6-ad10-9670be4fcb0d'), (b'x-ms-ags-diagnostic', b'{"ServerInfo":{"DataCenter":"North Europe","Slice":"E","Ring":"4","ScaleUnit":"001","RoleInstance":"DU2PEPF000107E5"}}'), (b'SPLogId', b'89553da2-e00b-3001-531f-268400ba5220'), (b'Date', b'Mon, 21 Sep 2026 08:53:37 GMT'), (b'Content-Length', b'0')])
INFO [2026-09-21 08:53:37] httpx - HTTP Request: GET https://graph.microsoft.com/v1.0//drives/<drive-id/items/<item-id>/content "HTTP/1.1 302 Found"
DEBUG [2026-09-21 08:53:37] httpcore.http11 - receive_response_body.started request=<Request [b'GET']>
DEBUG [2026-09-21 08:53:37] httpcore.http11 - receive_response_body.complete
DEBUG [2026-09-21 08:53:37] httpcore.http11 - response_closed.started
DEBUG [2026-09-21 08:53:37] httpcore.http11 - response_closed.complete
<END OF LOGS>
Even explicit setting the direct option when creating the various clients has no impact. i.e. if I do the following before making the call, the same error occurs.
auth_provider = AzureIdentityAuthenticationProvider(...)
client = GraphClientFactory.create_with_default_middleware(options=graph_request_adapter.options | {kioo.RedirectHandlerOption.get_key(): kioo.RedirectHandlerOption(should_redirect=True)})
adapter = msg.graph_request_adapter.GraphRequestAdapter(auth_provider, client=client)
ctx = msg.graph_service_client.GraphServiceClient(request_adapter=adapter)
...
I think this issue was caused by commit d9180bb. Tagging @rksharma-owg for visibility.
- Dominant language
- Python
- Stars
- 31
- Forks
- 39
- Avg merge
- 13h 21m
- Merged PRs (30d)
- 46
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/kiota-python
-
help wanted type:bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
microsoft/kiota-python#477 · 2 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
microsoft/kiota-python#745 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 72/100
microsoft/kiota-python#737 · 1 comment ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
microsoft/kiota-python#722 · 1 comment ·
-
Difficulty 5/5 Over a week Newbie friendliness 18/100
microsoft/kiota-python#533 · 1 comment · 1 reaction ·
All issues in microsoft/kiota-python
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
anthropics/skills#1811 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
speaches-ai/speaches#678 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
datalayer/mcp-compose#42 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
conda-forge/spacy-feedstock#177 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
UKGovernmentBEIS/inspect_evals#2523 ·