Feature request: map appropriate HTTP request methods to update calls

Canisters can handle HTTP requests by providing a http_request function. However, http_request only allows making query calls.

With my PR, canisters can now also provide a function called http_request_update that allows making update calls.

When handling a HTTP request inside of http_request, if it’s necessary to make an update call, http_request can now return a response including the field upgrade with a value of true. This results in http_request_update to be called instead.

Whether any of this happens due to HTTP methods like GET or POST (or other aspects of the request) is left entirely up to the canister. I had originally inferred whether to “upgrade” from query call to update based on the HTTP method but allowing the canister to determine that explicitly is more flexible.

7 Likes