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

Add Http Client Adapter to allow usage of different http clients #26

Merged
merged 2 commits into from
Aug 8, 2024

Conversation

jcarvalho-ptech
Copy link
Contributor

No description provided.

@Imgkl
Copy link
Owner

Imgkl commented Aug 6, 2024

Hey @jcarvalho-ptech Thanks for this PR. Feature definitely sounds interesting.

I'll test it with couple of different clients and I'll update the PR.

@Imgkl Imgkl self-requested a review August 6, 2024 18:52
@jcarvalho-ptech
Copy link
Contributor Author

jcarvalho-ptech commented Aug 7, 2024

Thanks @Imgkl !

This would allow us to use any http client. An example using Chopper:

class EventFluxClientAdapter implements HttpClientAdapter {
  @override
  Future<StreamedResponse> send(BaseRequest request) async {
    chopper.ChopperClient client = GetIt.I.get(instanceName: "chopperClient");
    StreamedResponse response = (await client.send<Stream<List<int>>, String>(
            chopper.Request("GET", request.url, Uri.parse(""),
                headers: request.headers)))
        .base as StreamedResponse;
    return response;
   ...

And feel free to improve the PR!

@Imgkl
Copy link
Owner

Imgkl commented Aug 8, 2024

@jcarvalho-ptech Thanks for the example.

@Imgkl Imgkl merged commit 5886828 into Imgkl:main Aug 8, 2024
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