Skip to content

feat: add client-side Tower payment layer#161

Open
stevencartavia wants to merge 3 commits intotempoxyz:mainfrom
stevencartavia:tower-client-layer
Open

feat: add client-side Tower payment layer#161
stevencartavia wants to merge 3 commits intotempoxyz:mainfrom
stevencartavia:tower-client-layer

Conversation

@stevencartavia
Copy link
Copy Markdown
Contributor

Adds PaymentClientLayer<P>, a Tower Layer/Service that intercepts 402 responses, pays, and retries automatically. Gated behind the new tower-client feature flag, independent of the existing server-side tower feature.

Comment on lines +82 to +85
let provider = Arc::clone(&self.provider);

let clone = self.inner.clone();
let mut inner = std::mem::replace(&mut self.inner, clone);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks weird, why do we need to replace?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +88 to +91
let (parts, body) = req.into_parts();
let body_bytes = collect_body(body).await?;

let req = Request::from_parts(parts.clone(), body_bytes.clone());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need this?
we should jsut forward the request?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for retry capability

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