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

Expose RedirectAttempt and RedirectAction types #105

Closed
Tracked by #120
dtolnay opened this issue May 31, 2017 · 0 comments · Fixed by #137
Closed
Tracked by #120

Expose RedirectAttempt and RedirectAction types #105

dtolnay opened this issue May 31, 2017 · 0 comments · Fixed by #137
Labels
E-easy Effort: Easy! Start here :D
Milestone

Comments

@dtolnay
Copy link

dtolnay commented May 31, 2017

These are used in the signature of RedirectPolicy::custom. They are not currently exposed in a way that crates depending on reqwest can name them. That means custom must be called with a closure relying on type inference:

client.redirect(RedirectPolicy::custom(|attempt| {
    /* ... */
}));

It is not possible to factor the logic out into a function:

use reqwest::/* ??? */::{RedirectAttempt, RedirectAction};

fn my_policy(attempt: RedirectAttempt) -> RedirectAction {
    /* ... */
}

client.redirect(RedirectPolicy::custom(my_policy))

Let's expose RedirectAttempt and RedirectAction to make it possible to write such a function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-easy Effort: Easy! Start here :D
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants