How do you call http_request on localhost?

From the recent challenge to find the secret, i am wondering how we can call the http_request in local deployment?

public query func http_request() : async HttpResponse {
return {
status_code = 200;
headers = [(“content-type”, “text/plain”)];
body = T.encodeUtf8 (
“This is nomeata’s capture-the-ic-token canister.\n” #
“See GitHub - nomeata/capture-the-ic-token: Hack the canister, get the token for details.\n” #
“\n” #
"My current cycle balance: " # debug_show (ExperimentalCycles.balance()) # “\n” #
"Secret loaded from random tape: " # debug_show (O.isSome(secret)) # “\n” #
"Successful calls to set_certified_data: " # debug_show successful_calls # “\n” #
"Unsuccessful calls to set_certified_data: " # debug_show unsuccessful_calls # “\n”
)
}
};

One way is to use icx-proxy to forward HTTP requests.

2 Likes