Skip to content

Commit

Permalink
Update handling-get-post-requests.mdx
Browse files Browse the repository at this point in the history
  • Loading branch information
jessiemongeon1 authored Sep 27, 2024
1 parent e7d749d commit 9538fc0
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ For outgoing HTTP requests, the [HTTPS outcalls](./https-outcalls/https-outcalls

To handle incoming HTTP requests, canisters must define methods for `http_requests` and `http_requests_update` for `GET` and `POST` requests respectively.

All HTTP requests are handled by the ICP HTTP Gateway, therefore you cannot make direct `POST` calls to a canister's `http_request_update` method with HTTP clients such as curl. Instead, you can make a `POST` call to a canister's HTTP endpoint, then configure the canister's `http_request` method to [upgrade the call to `http_request_update` if necessary](/docs/current/references/http-gateway-protocol-spec#upgrade-to-update-calls). This is because the HTTP Gateway will first make a query call to the canister's endpoint, and will only upgrade to an update call if the canister's `http_request` is configured to do so. Below is an example `POST` call to a canister's endpoint:
All HTTP requests are handled by the ICP HTTP Gateway, therefore you cannot make direct `POST` calls to a canister's `http_request_update` method with HTTP clients such as curl. Instead, you can make a `POST` call to a canister's HTTP endpoint, then configure the canister's `http_request` method to [upgrade the call to `http_request_update` if necessary](/docs/current/references/http-gateway-protocol-spec#upgrade-to-update-calls). Below is an example `POST` call to a canister's endpoint:

```
curl -X POST -H "Content-Type: application/json" -d '{"key":"value"}' https://<canister-id>.raw.ic0.app/<endpoint>
Expand Down

0 comments on commit 9538fc0

Please sign in to comment.