You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Until recently, I was interacting with a canister via the HTTP interface using a reqwest client.
That all worked fine but I wanted a better story around authentication so I started migrating to ic-agent.
I'm almost done with that but ran into something at the very last step that is making me reconsider my approach to using ic-agent (not whether to use ic-agent at all, just my approach to using it)
My previous code relies on the fact that reqwest::blocking::Body::new takes a reader (R: Read + Send + 'static), and that I can configure a request by providing a reference to a reader that will get written to later.
For now I needed things to work in a blocking context, and it was easier to use the reqwest::blocking variant of things so I did that. I had planned to investigate switching to the async version at some point where the equivalent method appears to be reqwest::Body::wrap_stream
Since I at least know that the blocking version of reqwest allows providing a reader, and ic-agent also uses reqwest in ReqwestHttpReplicaV2Transport, I'm wondering if ic-agent could expose a similar interface.
Until recently, I was interacting with a canister via the HTTP interface using a
reqwest
client.That all worked fine but I wanted a better story around authentication so I started migrating to
ic-agent
.I'm almost done with that but ran into something at the very last step that is making me reconsider my approach to using
ic-agent
(not whether to useic-agent
at all, just my approach to using it)My previous code relies on the fact that
reqwest::blocking::Body::new
takes a reader (R: Read + Send + 'static
), and that I can configure a request by providing a reference to a reader that will get written to later.For now I needed things to work in a blocking context, and it was easier to use the
reqwest::blocking
variant of things so I did that. I had planned to investigate switching to the async version at some point where the equivalent method appears to bereqwest::Body::wrap_stream
Since I at least know that the blocking version of
reqwest
allows providing a reader, andic-agent
also usesreqwest
inReqwestHttpReplicaV2Transport
, I'm wondering ific-agent
could expose a similar interface.Could
agent::QueryBuilder::with_arg
andagent::UpdateBuilder::with_arg
be generalized to take readers instead?If that isn't feasible, is there another approach that would enable async streaming of the request body and response?
The text was updated successfully, but these errors were encountered: