Skip to content

Conversation

@linyihai
Copy link
Contributor

@linyihai linyihai commented Apr 2, 2025

Motivation

Due to Attempt fields are all private, that dissallows producting Attempt outside.

My another PR needs a way to construct a tower-http Attempt, see seanmonstar/reqwest#2617

Solution

Add a new method and passing all the needed fileds to produce the Attempt. This way has less expansibility when adding new fields to Attempt.

@seanmonstar
Copy link
Collaborator

I don't think this method should be required. If the loop in reqwest (which mostly exists to handle redirects) is replaced by putting the internal hyper.call() with a svc.call(), such that svc is a the hyper client (and any other eventual layers) wrapped in a tower_http::follow_redirect::FollowRedirect, then the Attempt will be constructed automatically and passed into our impl Policy.

Does all of that make sense? Would you like me to sketch out futher what I mean?

@linyihai
Copy link
Contributor Author

linyihai commented Apr 8, 2025

I don't think this method should be required. If the loop in reqwest (which mostly exists to handle redirects) is replaced by putting the internal hyper.call() with a svc.call(), such that svc is a the hyper client (and any other eventual layers) wrapped in a tower_http::follow_redirect::FollowRedirect, then the Attempt will be constructed automatically and passed into our impl Policy.

I'll look into tower_http::follow_redirect::FollowRedirect, thanks for you reminders.

Would you like me to sketch out futher what I mean?

Yes, It would be nice if there were more implementation details

@linyihai linyihai closed this Apr 9, 2025
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

Successfully merging this pull request may close these issues.

2 participants