Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restrict is(redirect|error) to integers #1117

Merged
merged 1 commit into from
Oct 11, 2023
Merged
Changes from all commits
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
6 changes: 3 additions & 3 deletions src/Messages.jl
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,8 @@ issafe(method) = method in ["GET", "HEAD", "OPTIONS", "TRACE"]
Does this `Response` have an error status?
"""
iserror(r::Response) = iserror(r.status)
iserror(status) = status != 0 && status != 100 && status != 101 &&
(status < 200 || status >= 300) && !isredirect(status)
iserror(status::Integer) = status != 0 && status != 100 && status != 101 &&
(status < 200 || status >= 300) && !isredirect(status)

"""
isredirect(::Response)
Expand All @@ -245,7 +245,7 @@ Does this `Response` have a redirect status?
"""
isredirect(r::Response) = isredirect(r.status)
isredirect(r::Request) = allow_redirects(r) && !redirectlimitreached(r)
isredirect(status) = status in (301, 302, 303, 307, 308)
isredirect(status::Integer) = status in (301, 302, 303, 307, 308)

# whether the redirect limit has been reached for a given request
# set in the RedirectRequest layer once the limit is reached
Expand Down
Loading