Skip to content

Commit 8f28fb3

Browse files
ggreifclaudemraszyk
authored
feat: allow PATCH in http_request for non-replicated calls (#289)
Migrated from dfinity/portal#6245 (moved to this repo per reviewer request — the spec is now hosted here). ### What - `public/references/ic.did`: `method` variant → `variant { get; head; post; put; delete; patch }`. - `docs/references/ic-interface-spec/management-canister.md`: document `PATCH` alongside `PUT`/`DELETE` as supported in non-replicated mode only (two paragraphs). - `docs/references/ic-interface-spec/changelog.md`: new `0.63.0 (TBD)` entry. > **Note:** the changelog uses `0.63.0` because `0.62.0` is already present in this repo with different content (2025-05-26). Please confirm the correct version number before merging. ### Why `PATCH` is the last common REST verb missing after `PUT`/`DELETE` landed (dfinity/portal#6199). It is pervasive in modern REST APIs for partial updates (Google Calendar, GitHub, Stripe, …). The concrete driver is generated Motoko clients for the Google Calendar API whose partial-update operations are otherwise un-callable. ### Why non-replicated only Same rationale as `PUT`/`DELETE`: in replicated mode an outcall is issued once per replica; `PATCH` is additionally not guaranteed idempotent (RFC 5789 §2). The existing `is_replicated` machinery already covers it; no new mechanism is introduced. ### Notes - Spec/docs change only. The corresponding runtime implementation is in dfinity/ic#10378. - The date in the changelog entry should be updated to the mainnet rollout date before merging. - Originally opened as dfinity/portal#6245; that PR will be closed once this one merges. --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: mraszyk <31483726+mraszyk@users.noreply.github.com>
1 parent 3581e4f commit 8f28fb3

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

‎docs/references/ic-interface-spec/changelog.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ sidebar:
88

99
## Changelog {#changelog}
1010

11+
### 0.63.0 (2026-06-29) {$0_63_0}
12+
* Support for the HTTP method `PATCH` in canister `http_request` in non-replicated mode.
13+
1114
### 0.62.0 (2025-05-26) {$0_62_0}
1215
* Inter-canister response callback messages might still be executed after the condition for `canister_on_low_wasm_memory` is triggered
1316
and before the function `canister_on_low_wasm_memory` is executed.

‎docs/references/ic-interface-spec/management-canister.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ In the replicated mode, the responses for all identical requests must match, too
640640

641641
For this reason, the calling canister can supply a transformation function, which the IC uses to let the canister sanitize the responses from such unique values. The transformation function is executed separately on the corresponding response received for a request (both in replicated and non-replicated modes). Only the transformed response will be available to the calling canister.
642642

643-
Currently, the `GET`, `HEAD`, and `POST` methods are supported for HTTP requests. Additionally, the `PUT` and `DELETE` methods are supported in non-replicated mode only. `PUT` and `DELETE` are restricted to non-replicated mode to avoid confusing race conditions that may occur with replicated execution.
643+
Currently, the `GET`, `HEAD`, and `POST` methods are supported for HTTP requests. Additionally, the `PUT`, `DELETE`, and `PATCH` methods are supported in non-replicated mode only. `PUT`, `DELETE`, and `PATCH` are restricted to non-replicated mode to avoid confusing race conditions that may occur with replicated execution.
644644

645645
It is important to note the following for the usage of the `POST` method:
646646

@@ -664,7 +664,7 @@ The following parameters should be supplied for the call:
664664

665665
- `max_response_bytes` - optional, specifies the maximal size of the response in bytes. If provided, the value must not exceed `2MB` (`2,000,000B`). The call will be charged based on this parameter. If not provided, the maximum of `2MB` will be used.
666666

667-
- `method` - currently, `GET`, `HEAD`, and `POST` are supported. Additionally, `PUT` and `DELETE` are supported in non-replicated mode only.
667+
- `method` - currently, `GET`, `HEAD`, and `POST` are supported. Additionally, `PUT`, `DELETE`, and `PATCH` are supported in non-replicated mode only.
668668

669669
- `headers` - list of HTTP request headers and their corresponding values
670670

‎public/references/ic.did‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ type deposit_cycles_args = record {
344344
type http_request_args = record {
345345
url : text;
346346
max_response_bytes : opt nat64;
347-
method : variant { get; head; post; put; delete };
347+
method : variant { get; head; post; put; delete; patch };
348348
headers : vec http_header;
349349
body : opt blob;
350350
transform : opt record {

0 commit comments

Comments
 (0)