Migrate http_request to ic_cdk v0.18: cycles argument?

I would like to migrate (PR) the deprecated ic_cdk::api::management_canister::http_request::http_request to ic_cdk::management_canister::http_request, which, I assume, was introduced in ic_cdk@0.18.

I’ve figured out the new imports and renamed arguments, but I can’t find any field to specify the cycles for payment.

// This function takes 1 parameter, but 2 parameters were supplied [E0061]
 match http_request(&args, MY_CYCLES).await {

I vaguely remember that starting from a certain version, specifying cycles for HTTPS outcalls was no longer required. However, I can’t find any documentation confirming this neither in the ic_cdk CHANGELOG nor in the migration guide.

Is this assumption correct and the documentation is simply missing (or I am missing the entry), or is it incorrect and I should be using another function to perform an HTTP request with the latest ic_cdk?

The behavior of the cycles payment is explained in this section: http_request in ic_cdk::management_canister - Rust

The one-liner doc of the method “Makes an HTTP outcall with a user-specified amount of cycles.” was copied from the previous version and is outdated. This doc issue has been fixed in a recent PR and will be reflected on the docs.rs site when we cut next release (planned this week).

Thanks, I followed the link you shared to the cost_http_request which made the answer clear.

Function cost_http_request
Calculates the cost of making an HTTP outcall with the given HttpRequestArgs.
http_request and http_request_with_closure invoke this method internally and attach the required cycles to the call.

Nice and welcomed improvement btw :+1: