Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

Commit

Permalink
chore: allow unused http_get (#674)
Browse files Browse the repository at this point in the history
* chore: allow unused http_get

* Update ethers-contract/ethers-contract-abigen/src/util.rs

Co-authored-by: Georgios Konstantopoulos <[email protected]>

* chore: update cfgs

Co-authored-by: Georgios Konstantopoulos <[email protected]>
  • Loading branch information
mattsse and gakonst authored Dec 11, 2021
1 parent 0e133e4 commit 0769174
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions ethers-contract/ethers-contract-abigen/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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"))
}
}
}
Expand Down

0 comments on commit 0769174

Please sign in to comment.