Skip to content
This repository was archived by the owner on Oct 14, 2024. It is now read-only.

Fix: handle relative redirects that have url.scheme == '' #401

Merged
merged 6 commits into from
Aug 12, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion kiota_http/middleware/redirect_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def _redirect_url(
except Exception as exc:
raise Exception(f"Invalid URL in location header: {exc}.")

if url.scheme != request.url.scheme and not options.allow_redirect_on_scheme_change:
if not u.is_relative_url and url.scheme != request.url.scheme and not options.allow_redirect_on_scheme_change:
raise Exception(
"Redirects with changing schemes not allowed by default.\
You can change this by modifying the allow_redirect_on_scheme_change\
Expand Down