Skip to content

Adds injectable HTTP requester support to client#13

Open
jobezic wants to merge 1 commit intoethanndickson:mainfrom
jobezic:feature/new_with_requester
Open

Adds injectable HTTP requester support to client#13
jobezic wants to merge 1 commit intoethanndickson:mainfrom
jobezic:feature/new_with_requester

Conversation

@jobezic
Copy link
Copy Markdown

@jobezic jobezic commented Feb 11, 2026

Introduces a trait for HTTP requesters, allowing custom implementations to be injected into the client.
Enables greater flexibility and testability by decoupling HTTP logic from the client core.

Copy link
Copy Markdown
Owner

@ethanndickson ethanndickson left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! I hope this library can be of some use :)

The Rust ecosystem has changed a lot since this was written, and core parts of the library like our HTTP Client code could do with some modernizing & generally some love. 🥲

pub struct Client {
addr: Arc<String>,
inner: ClientInner,
inner: Arc<dyn HttpRequester>,
Copy link
Copy Markdown
Owner

@ethanndickson ethanndickson Feb 13, 2026

Choose a reason for hiding this comment

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

Instead of replacing the enum here, could we perhaps extend it?
IIRC, something like this could work:

pub(crate) enum ClientInner {
    Https(HTTPSClient),
    Http(HTTPClient),
    Custom(Arc<dyn HttpRequester>),
}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

sounds like a good idea, check my last changes please.

@jobezic jobezic force-pushed the feature/new_with_requester branch from 1978dc8 to 43e73c1 Compare April 8, 2026 12:26
@jobezic jobezic force-pushed the feature/new_with_requester branch from 43e73c1 to aca801c Compare April 8, 2026 12:52
@jobezic jobezic requested a review from ethanndickson April 8, 2026 14:39
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