We are using http_request query call as follows
#[ic_cdk_macros::query]
fn http_request(request: HttpRequest) -> HttpResponse {
There is this paragraph in the IC specification on http_request (The Internet Computer Interface Specification | Internet Computer)
Since query calls have 0 cycles charged, does this apply only for http_request update calls ? Or is it different in the case of http_request and both are charged ?
1 Like
This is an unfortunate naming clash. http_request
in the spec refers to the management canister’s function http_request
which performs an HTTPS outcall. It cannot be called as/from a query call.
The function you’re implementing (sadly also called http_request
, but this time defined on your own canister) is defined in the HTTP gateway spec instead. It’s the one that is called as a query when someone tries to load your canister in the browser.
2 Likes