Skip to content

fix(pic): read HTTPS outcalls made with PUT, DELETE and PATCH - #320

Merged
raymondk merged 1 commit into
dfinity:mainfrom
alexandru-uta:fix/https-outcall-methods
Oct 22, 2026
Merged

raymondk merged 1 commit into
dfinity:mainfrom
alexandru-uta:fix/https-outcall-methods

Conversation

@alexandru-uta

Copy link
Copy Markdown
Collaborator

PocketIC reports a pending HTTPS outcall's method as GET, POST, HEAD, PUT, DELETE or PATCH, but getPendingHttpsOutcalls only decoded the first three and threw Unknown canister HTTP method: PUT for the rest, so a test could not answer a canister's PUT, DELETE or PATCH request.

CanisterHttpMethod and its decoder now cover all six methods. The test canister gains http_request_status, which makes a non-replicated outcall with a given method (the IC allows PUT, DELETE and PATCH only there), and a new spec reads and answers one outcall per method. With the decoder change reverted, the PUT, DELETE and PATCH cases fail with the decode error.

🤖 Generated with Claude Code

PocketIC reports a pending HTTPS outcall's method as GET, POST, HEAD,
PUT, DELETE or PATCH, but getPendingHttpsOutcalls only decoded the first
three and threw "Unknown canister HTTP method" for the rest. A test of a
canister that sends a PUT, DELETE or PATCH request could not answer it.

The test canister gains a method that makes a non-replicated outcall
with a given method (the IC allows PUT, DELETE and PATCH only there).
The new test reads and answers one outcall per method; before the fix,
the PUT, DELETE and PATCH cases failed with the decode error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cla-idx-bot

cla-idx-bot Bot commented Oct 22, 2026

Copy link
Copy Markdown

Dear @alexandru-uta,

In order to potentially merge your code in this open-source repository and therefore proceed with your contribution, we need to have your approval on DFINITY's CLA.

If you decide to agree with it, please visit this issue and read the instructions there. Once you have signed it, re-trigger the workflow on this PR to see if your code can be merged.

— The DFINITY Foundation

@alexandru-uta
alexandru-uta marked this pull request as ready for review October 22, 2026 14:45
@alexandru-uta
alexandru-uta requested a review from a team as a code owner October 22, 2026 14:45
Copilot AI balanced review requested due to automatic review settings October 22, 2026 14:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The method enums, decoder, and test-canister interfaces are consistent, with regression coverage for all six methods and no unresolved findings.

No open issues 🎉

What changed in this PR

This PR fixes PocketIC’s pending HTTPS outcall decoding so tests can read and answer PUT, DELETE, and PATCH requests alongside GET, POST, and HEAD.

Changes:

  • Extends public and client method enums and decoding to support all six methods.
  • Adds a test-canister endpoint for non-replicated HTTPS outcalls.
  • Adds regression tests that read and answer an outcall for each method.
File Description
packages/​pic/​tests/​test-canister/​test_canister.did Declares the HTTP method variant and test endpoint.
packages/​pic/​tests/​test-canister/​main.mo Implements non-replicated outcalls with a selected method.
packages/​pic/​tests/​test-canister/​declarations/​test_canister.did.js Adds Candid bindings for the endpoint.
packages/​pic/​tests/​test-canister/​declarations/​test_canister.did.d.ts Adds TypeScript types for the endpoint.
packages/​pic/​tests/​src/​https-outcalls.spec.ts Tests decoding and responding to all six methods.
packages/​pic/​src/​pocket-ic-types.ts Extends the public HTTP method enum.
packages/​pic/​src/​pocket-ic-client-types.ts Extends client enums and method decoding.

Review effort: Balanced

@cla-idx-bot

cla-idx-bot Bot commented Oct 22, 2026

Copy link
Copy Markdown

Dear @alexandru-uta,

In order to potentially merge your code in this open-source repository and therefore proceed with your contribution, we need to have your approval on DFINITY's CLA.

If you decide to agree with it, please visit this issue and read the instructions there. Once you have signed it, re-trigger the workflow on this PR to see if your code can be merged.

— The DFINITY Foundation

@raymondk
raymondk added this pull request to the merge queue Oct 22, 2026
Merged via the queue into dfinity:main with commit 288c039 Oct 22, 2026
24 of 26 checks passed
Copilot AI mentioned this pull request Oct 22, 2026
alexandru-uta added a commit that referenced this pull request Oct 23, 2026
…ackport) (#322)

Backport of #320 to the 0.23 release line, for a 0.23.1 patch release.

PocketIC reports a pending HTTPS outcall's method as GET, POST, HEAD,
PUT, DELETE or PATCH, but `getPendingHttpsOutcalls` only decoded the
first three and threw `Unknown canister HTTP method: PUT` for the rest,
so a test could not answer a canister's PUT, DELETE or PATCH request.
`CanisterHttpMethod` and its decoder now cover all six methods; the API
is otherwise unchanged from 0.23.0.

The test canister gains `http_request_status`, which makes a
non-replicated outcall with a given method (the IC allows PUT, DELETE
and PATCH only there), and a new spec reads and answers one outcall per
method. PocketIC 14, which this line pins, makes no PATCH outcalls, so
the spec covers GET, HEAD, POST, PUT and DELETE; with the decoder change
reverted, PUT and DELETE fail with the decode error. PATCH passes
against PocketIC 15.

0.23.1 should be published under its own dist-tag so it does not replace
0.25.0 as `latest`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants