-
Notifications
You must be signed in to change notification settings - Fork 2.9k
FuelClient::new removes potentially critical path information #3176
Copy link
Copy link
Open
Description
FuelClient::new used the FromStr implementation of FuelClient. This implementation is curious:
impl FromStr for FuelClient {
type Err = anyhow::Error;
fn from_str(str: &str) -> Result<Self, Self::Err> {
let mut raw_url = str.to_string();
if !raw_url.starts_with("http") {
raw_url = format!("http://{raw_url}");
}
let mut url = reqwest::Url::parse(&raw_url)
.map_err(anyhow::Error::msg)
.with_context(|| format!("Invalid fuel-core URL: {str}"))?;
url.set_path("/v1/graphql");
...
}
}Do you see it? url.set_path wipes out any path information on the url. Some node providers (quiknode) use the path to store auth information. Of course there is also the option to use headers for quiknode, but there is not an implementation for that here either.
I don't really understand why babysitting the url here is necessary, and it seems to me like this cleaning should just be removed and users be responsible for using correct url paths, however either way this should be rethought.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels