mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-12 18:56:12 +00:00
fmt
This commit is contained in:
parent
9184800582
commit
93b96c7af5
|
@ -290,8 +290,7 @@ async fn is_image_content_type(client: &ClientWithMiddleware, url: &Url) -> Resu
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn client_builder(settings: &Settings) -> ClientBuilder {
|
pub fn client_builder(settings: &Settings) -> ClientBuilder {
|
||||||
let user_agent =
|
let user_agent = format!(
|
||||||
format!(
|
|
||||||
"Lemmy/{}; +{}",
|
"Lemmy/{}; +{}",
|
||||||
VERSION,
|
VERSION,
|
||||||
settings.get_protocol_and_hostname()
|
settings.get_protocol_and_hostname()
|
||||||
|
@ -316,9 +315,7 @@ mod tests {
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn test_site_metadata() {
|
async fn test_site_metadata() {
|
||||||
let settings = &SETTINGS.clone();
|
let settings = &SETTINGS.clone();
|
||||||
let client = client_builder(settings).build()
|
let client = client_builder(settings).build().unwrap().into();
|
||||||
.unwrap()
|
|
||||||
.into();
|
|
||||||
let sample_url = Url::parse("https://gitlab.com/IzzyOnDroid/repo/-/wikis/FAQ").unwrap();
|
let sample_url = Url::parse("https://gitlab.com/IzzyOnDroid/repo/-/wikis/FAQ").unwrap();
|
||||||
let sample_res = fetch_site_metadata(&client, &sample_url).await.unwrap();
|
let sample_res = fetch_site_metadata(&client, &sample_url).await.unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
|
|
@ -59,13 +59,12 @@ pub(crate) mod tests {
|
||||||
|
|
||||||
use activitypub_federation::config::{Data, FederationConfig};
|
use activitypub_federation::config::{Data, FederationConfig};
|
||||||
use anyhow::anyhow;
|
use anyhow::anyhow;
|
||||||
use lemmy_api_common::{context::LemmyContext};
|
use lemmy_api_common::{context::LemmyContext, request::client_builder};
|
||||||
use lemmy_db_schema::{source::secret::Secret, utils::build_db_pool_for_tests};
|
use lemmy_db_schema::{source::secret::Secret, utils::build_db_pool_for_tests};
|
||||||
use lemmy_utils::{rate_limit::RateLimitCell, settings::SETTINGS};
|
use lemmy_utils::{rate_limit::RateLimitCell, settings::SETTINGS};
|
||||||
use reqwest::{Request, Response};
|
use reqwest::{Request, Response};
|
||||||
use reqwest_middleware::{ClientBuilder, Middleware, Next};
|
use reqwest_middleware::{ClientBuilder, Middleware, Next};
|
||||||
use task_local_extensions::Extensions;
|
use task_local_extensions::Extensions;
|
||||||
use lemmy_api_common::request::client_builder;
|
|
||||||
|
|
||||||
struct BlockedMiddleware;
|
struct BlockedMiddleware;
|
||||||
|
|
||||||
|
@ -87,9 +86,7 @@ pub(crate) mod tests {
|
||||||
// call this to run migrations
|
// call this to run migrations
|
||||||
let pool = build_db_pool_for_tests().await;
|
let pool = build_db_pool_for_tests().await;
|
||||||
|
|
||||||
let client = client_builder(&SETTINGS)
|
let client = client_builder(&SETTINGS).build().unwrap();
|
||||||
.build()
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let client = ClientBuilder::new(client).with(BlockedMiddleware).build();
|
let client = ClientBuilder::new(client).with(BlockedMiddleware).build();
|
||||||
let secret = Secret {
|
let secret = Secret {
|
||||||
|
|
|
@ -28,6 +28,7 @@ use clap::{ArgAction, Parser};
|
||||||
use lemmy_api_common::{
|
use lemmy_api_common::{
|
||||||
context::LemmyContext,
|
context::LemmyContext,
|
||||||
lemmy_db_views::structs::SiteView,
|
lemmy_db_views::structs::SiteView,
|
||||||
|
request::client_builder,
|
||||||
send_activity::{ActivityChannel, MATCH_OUTGOING_ACTIVITIES},
|
send_activity::{ActivityChannel, MATCH_OUTGOING_ACTIVITIES},
|
||||||
utils::{
|
utils::{
|
||||||
check_private_instance_and_federation_enabled,
|
check_private_instance_and_federation_enabled,
|
||||||
|
@ -68,7 +69,6 @@ use {
|
||||||
prometheus::default_registry,
|
prometheus::default_registry,
|
||||||
prometheus_metrics::serve_prometheus,
|
prometheus_metrics::serve_prometheus,
|
||||||
};
|
};
|
||||||
use lemmy_api_common::request::client_builder;
|
|
||||||
|
|
||||||
#[derive(Parser, Debug)]
|
#[derive(Parser, Debug)]
|
||||||
#[command(
|
#[command(
|
||||||
|
|
Loading…
Reference in a new issue