-
Notifications
You must be signed in to change notification settings - Fork 78
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
feat: add http_request_next method (large asset support) #129
feat: add http_request_next method (large asset support) #129
Conversation
|
||
#[derive(CandidType, Deserialize)] | ||
pub struct HttpGetChunkResponse { | ||
pub chunk: Vec<u8>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pub chunk: Vec<u8>, | |
#[serde(with = "serde_bytes")] | |
pub chunk: Vec<u8>, |
@@ -29,6 +29,18 @@ pub struct HttpResponse { | |||
pub body: Vec<u8>, | |||
} | |||
|
|||
#[derive(CandidType)] | |||
pub struct HttpGetChunkRequest { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can this be moved inside the body of http_get_chunk
similar to https://github.com/dfinity/agent-rs/blob/next/ic-utils/src/interfaces/management_canister.rs#L453
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need design. See dfinity/dx-triage#126 where I'll start the discussion.
@@ -192,6 +193,25 @@ impl Argument { | |||
} | |||
} | |||
|
|||
/// Add an IDLValue Argument. If the current value of Argument is Raw, will set the | |||
/// result to an error. If the current value is an error, will do nothing. | |||
pub fn push_value_arg(&mut self, arg: IDLValue) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IDLValue
implements CandidType, so you should be able to use push_idl_arg
with an IDLValue
. Was there any issue with using that other function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, IDLValue::ty()
calls unreachable() : https://github.com/dfinity/candid/blob/master/rust/candid/src/parser/value.rs#L326
called from here: https://github.com/dfinity/candid/blob/master/rust/candid/src/ser.rs#L28
@@ -258,6 +278,16 @@ impl<'agent, 'canister: 'agent, Interface> SyncCallBuilder<'agent, 'canister, In | |||
self | |||
} | |||
|
|||
/// Add an argument to the candid argument list. This requires Candid arguments, if | |||
/// there is a raw argument set (using [with_arg_raw]), this will fail. | |||
pub fn with_value_arg( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question as above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay LGTM, but this is an anti-pattern. We might have to deprecate these methods if we make IDLValue work.
Entered #132 to make |
1. The `http_request` response now includes an optional `next_token` field if there are more chunks after the first 2. The `dfx` built-in webserver calls `http_request_next` to get subsequent chunks Requires dfinity/agent-rs#129 Implements dfinity/dx-triage#126
Part of https://github.com/dfinity/dx-triage/issues/126
See also dfinity/sdk#1512