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

fix: workaround for dfinity/candid#273 #323

Merged

Conversation

Daniel-Bloom-dfinity
Copy link
Contributor

@Daniel-Bloom-dfinity Daniel-Bloom-dfinity commented Mar 17, 2022

With a little elbow grease we can even get around Func's limitations.

Introduces a new type HttpRequestStreamingCallback which properly serializes/deserializes callbacks of the form:
callback : (Token) -> (StreamingCallbackHttpResponse) query;

We use ArgToken (which returns Type::Empty from ty) for the abstract form, because arguments subtype in the opposite direction so:

callback : (Empty) -> (StreamingCallbackHttpResponse<Reserved>) query;

Will match without knowing what the Token contents are.

With a little elbow grease we can even get around `Func`'s limitations.

We use `Type::Empty` because args subtype in the opposite direction.
Copy link
Contributor

@chenyan-dfinity chenyan-dfinity left a comment

Choose a reason for hiding this comment

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

LGTM as long as your tests are happy.

ic-utils/src/interfaces/http_request.rs Outdated Show resolved Hide resolved
Co-authored-by: Yan Chen <48968912+chenyan-dfinity@users.noreply.github.com>
@ericswanson-dfinity ericswanson-dfinity merged commit 4d0595a into dfinity:main Mar 17, 2022
@Daniel-Bloom-dfinity Daniel-Bloom-dfinity deleted the dbloom/callback branch March 17, 2022 19:09
ueldidev0401 pushed a commit to ueldidev0401/contract-dfinity that referenced this pull request Jun 30, 2022
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.

3 participants