andogq / qubit

Seamless RPC for Rust & TypeScript
MIT License
21 stars 4 forks source link

Better support for custom transports #55

Closed nicolai0 closed 4 months ago

nicolai0 commented 4 months ago

Problem:

My qubit server is running in AWS Lambda behind an AWS Lambda Function URL with IAM authentication enabled. In order to handle the authentication part, I need to use this package (https://www.npmjs.com/package/aws-sigv4-fetch) which replaces the regular fetch function and adds automatic signing of my requests. Currently there's no way to inject a custom fetcher into the http transport.

Workaround

What I've done now is copy-paste it, but the parse_response is not exported so I end up having to copy-paste quite a lot.

Version:

@qubit-rs/client = 0.3.1

andogq commented 4 months ago

very good timing, I actually just implemented this for myself today!

when you create the http client, you can now provide HttpOptions where you can override the fetch implementation.

Hopefully this addresses your requirements!

@qubit-rs/client@0.3.3

nicolai0 commented 4 months ago

Awesome, I'll try it out. Thanks!