Make awc optional
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
asonix 2023-08-17 16:57:49 -05:00
parent 5dec9f6427
commit 0835c0118e
2 changed files with 8 additions and 2 deletions

View file

@ -1,17 +1,21 @@
[package] [package]
name = "actix-webfinger" name = "actix-webfinger"
description = "Types and helpers to create and fetch Webfinger resources" description = "Types and helpers to create and fetch Webfinger resources"
version = "0.4.1" version = "0.5.0"
license = "GPL-3.0" license = "GPL-3.0"
authors = ["asonix <asonix@asonix.dog>"] authors = ["asonix <asonix@asonix.dog>"]
repository = "https://git.asonix.dog/asonix/actix-webfinger" repository = "https://git.asonix.dog/asonix/actix-webfinger"
readme = "README.md" readme = "README.md"
edition = "2021" edition = "2021"
[features]
default = ["client"]
client = ["dep:awc"]
[dependencies] [dependencies]
actix-rt = "2.6.0" actix-rt = "2.6.0"
actix-web = { version = "4.0.1", default-features = false } actix-web = { version = "4.0.1", default-features = false }
awc = { version = "3.0.0", default-features = false } awc = { version = "3.0.0", default-features = false, optional = true }
serde = "1.0" serde = "1.0"
serde_derive = "1.0" serde_derive = "1.0"
thiserror = "1.0" thiserror = "1.0"

View file

@ -117,6 +117,7 @@ use actix_web::{
web::{get, Query}, web::{get, Query},
FromRequest, HttpResponse, Resource, FromRequest, HttpResponse, Resource,
}; };
#[cfg(feature = "client")]
use awc::Client; use awc::Client;
use serde_derive::{Deserialize, Serialize}; use serde_derive::{Deserialize, Serialize};
use std::{future::Future, pin::Pin}; use std::{future::Future, pin::Pin};
@ -635,6 +636,7 @@ impl Webfinger {
.json(&self) .json(&self)
} }
#[cfg(feature = "client")]
/// Fetch a webfinger with subject `user` from a given `domain` /// Fetch a webfinger with subject `user` from a given `domain`
/// ///
/// This method takes a `Client` so derivative works can provide their own configured clients /// This method takes a `Client` so derivative works can provide their own configured clients