// fetch metadata for the input url
fetch metadata for the input url
fetch metadata for the input url
fn resolve_package_metadata(
    package_name: &str,
    package_info_url: &str,
) -> Fallible<super::serial::RawPackageMetadata> {
    let spinner = progress_spinner(&format!("Fetching package metadata: {}", package_info_url));
    let response_text = reqwest::get(package_info_url)
        .and_then(|resp| resp.error_for_status())
        .and_then(|mut resp| resp.text())
        .with_context(|err| match err.status() {
            Some(reqwest::StatusCode::NOT_FOUND) => ErrorDetails::PackageNotFound {
                package: package_name.into(),
            },
            _ => ErrorDetails::PackageMetadataFetchError {
                from_url: package_info_url.into(),
            },
        })?;
    let metadata: super::serial::RawPackageMetadata = serde_json::de::from_str(&response_text)
        .with_context(|_| ErrorDetails::ParsePackageMetadataError {
            from_url: package_info_url.to_string(),
        })?;
    spinner.finish_and_clear();
    Ok(metadata)
}
fn resolve_package_metadata ( package_name : & str , package_info_url : & str , ) -> Fallible < super :: serial :: RawPackageMetadata > { let spinner = progress_spinner ( & format ! ( " " package_info_url ) ) ; let response_text = reqwest :: get ( package_info_url ) . and_then ( | resp | resp . error_for_status ( ) ) . and_then ( | mut resp | resp . text ( ) ) . with_context ( | err | match err . status ( ) { Some ( reqwest :: StatusCode :: NOT_FOUND ) => ErrorDetails :: PackageNotFound { package : package_name . into ( ) , } , _ => ErrorDetails :: PackageMetadataFetchError { from_url : package_info_url . into ( ) , } , } ) ? ; let metadata : super :: serial :: RawPackageMetadata = serde_json :: de :: from_str ( & response_text ) . with_context ( | _ | ErrorDetails :: ParsePackageMetadataError { from_url : package_info_url . to_string ( ) , } ) ? ; spinner . finish_and_clear ( ) ; Ok ( metadata ) }
fetch metadata for the input url
fetch metadata for the input url
package_name
&str
package_info_url
&str