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

Respect :throw-exceptions flag in case of exceeding max redirects limit #190

Open
relonger opened this issue Mar 15, 2018 · 0 comments
Open

Comments

@relonger
Copy link

relonger commented Mar 15, 2018

in case of 4xx 5xx errors you don't throw any exceptions and just return response as is

if $!throw-exceptions {
        given $response.code {
            when /^4/ {
                X::HTTP::Response.new(:rc($response.status-line), :response($response)).throw;
            }
            when /^5/ {
                X::HTTP::Server.new(:rc($response.status-line), :response($response)).throw;
            }
        }
    }

but in case of to many 302 redirects you don't check this flag

if $.max-redirects < $.redirects-in-a-row {
            X::HTTP::Response.new(:rc('Max redirects exceeded'), :response($response)).throw;
        }

in my case I don't want to do any redirect at all, just get the first result. But setting max-redirects to zero doesn't help.

@relonger relonger changed the title Respect throw-exceptions in case of exceeding max redirects limit Respect :throw-exceptions flag in case of exceeding max redirects limit Mar 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant