chore: allow unused http_get (#674)
* chore: allow unused http_get * Update ethers-contract/ethers-contract-abigen/src/util.rs Co-authored-by: Georgios Konstantopoulos <me@gakonst.com> * chore: update cfgs Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>
This commit is contained in:
parent
0e133e4a87
commit
0769174b40
|
@ -2,7 +2,6 @@ use ethers_core::types::Address;
|
|||
use std::path::PathBuf;
|
||||
|
||||
use anyhow::{anyhow, Result};
|
||||
use cfg_if::cfg_if;
|
||||
use inflector::Inflector;
|
||||
use proc_macro2::{Ident, Literal, Span, TokenStream};
|
||||
use quote::quote;
|
||||
|
@ -84,12 +83,13 @@ where
|
|||
}
|
||||
|
||||
/// Perform an HTTP GET request and return the contents of the response.
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
pub fn http_get(_url: &str) -> Result<String> {
|
||||
cfg_if! {
|
||||
if #[cfg(any(target_arch = "wasm32", not(feature = "reqwest")))]{
|
||||
Err(anyhow!("HTTP is unsupported"))
|
||||
} else {
|
||||
cfg_if::cfg_if! {
|
||||
if #[cfg(feature = "reqwest")]{
|
||||
Ok(reqwest::blocking::get(_url)?.text()?)
|
||||
} else {
|
||||
Err(anyhow!("HTTP is unsupported"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue