Once the TARGET_URI datastore option is being used, you can access the uri with the target_uri method, so target_uri.to_s can be used to get the URI.

Check the documentation available at https://github.com/rapid7/metasploit-framework/wiki/How-to-Send-an-HTTP-Request-Using-HTTPClient