From 21c7176b1abbcf3b36a19e0355d451a5773f8610 Mon Sep 17 00:00:00 2001 From: Sunli Date: Fri, 5 Jan 2024 22:40:54 +0800 Subject: [PATCH] update examples --- examples/{openapi => disabled}/auth-github/Cargo.toml | 0 examples/{openapi => disabled}/auth-github/src/main.rs | 0 examples/{poem => disabled}/tonic/Cargo.toml | 0 examples/{poem => disabled}/tonic/build.rs | 0 examples/{poem => disabled}/tonic/proto/helloworld.proto | 0 examples/{poem => disabled}/tonic/src/client.rs | 0 examples/{poem => disabled}/tonic/src/main.rs | 0 examples/poem/acme-expanded-http-01/src/main.rs | 3 +-- examples/poem/opentelemetry-jaeger/src/server1.rs | 3 +-- poem/src/listener/acme/client.rs | 2 +- 10 files changed, 3 insertions(+), 5 deletions(-) rename examples/{openapi => disabled}/auth-github/Cargo.toml (100%) rename examples/{openapi => disabled}/auth-github/src/main.rs (100%) rename examples/{poem => disabled}/tonic/Cargo.toml (100%) rename examples/{poem => disabled}/tonic/build.rs (100%) rename examples/{poem => disabled}/tonic/proto/helloworld.proto (100%) rename examples/{poem => disabled}/tonic/src/client.rs (100%) rename examples/{poem => disabled}/tonic/src/main.rs (100%) diff --git a/examples/openapi/auth-github/Cargo.toml b/examples/disabled/auth-github/Cargo.toml similarity index 100% rename from examples/openapi/auth-github/Cargo.toml rename to examples/disabled/auth-github/Cargo.toml diff --git a/examples/openapi/auth-github/src/main.rs b/examples/disabled/auth-github/src/main.rs similarity index 100% rename from examples/openapi/auth-github/src/main.rs rename to examples/disabled/auth-github/src/main.rs diff --git a/examples/poem/tonic/Cargo.toml b/examples/disabled/tonic/Cargo.toml similarity index 100% rename from examples/poem/tonic/Cargo.toml rename to examples/disabled/tonic/Cargo.toml diff --git a/examples/poem/tonic/build.rs b/examples/disabled/tonic/build.rs similarity index 100% rename from examples/poem/tonic/build.rs rename to examples/disabled/tonic/build.rs diff --git a/examples/poem/tonic/proto/helloworld.proto b/examples/disabled/tonic/proto/helloworld.proto similarity index 100% rename from examples/poem/tonic/proto/helloworld.proto rename to examples/disabled/tonic/proto/helloworld.proto diff --git a/examples/poem/tonic/src/client.rs b/examples/disabled/tonic/src/client.rs similarity index 100% rename from examples/poem/tonic/src/client.rs rename to examples/disabled/tonic/src/client.rs diff --git a/examples/poem/tonic/src/main.rs b/examples/disabled/tonic/src/main.rs similarity index 100% rename from examples/poem/tonic/src/main.rs rename to examples/disabled/tonic/src/main.rs diff --git a/examples/poem/acme-expanded-http-01/src/main.rs b/examples/poem/acme-expanded-http-01/src/main.rs index bbfc845102..5c4750b777 100644 --- a/examples/poem/acme-expanded-http-01/src/main.rs +++ b/examples/poem/acme-expanded-http-01/src/main.rs @@ -31,8 +31,7 @@ async fn main() -> Result<(), std::io::Error> { } tracing_subscriber::fmt::init(); - let mut acme_client = - AcmeClient::try_new(&LETS_ENCRYPT_PRODUCTION.parse().unwrap(), vec![]).await?; + let mut acme_client = AcmeClient::try_new(LETS_ENCRYPT_PRODUCTION, vec![]).await?; let cert_resolver = Arc::new(ResolveServerCert::default()); let challenge = ChallengeType::Http01; let keys_for_http_challenge = Http01TokensMap::new(); diff --git a/examples/poem/opentelemetry-jaeger/src/server1.rs b/examples/poem/opentelemetry-jaeger/src/server1.rs index c04d04ae98..8978245853 100644 --- a/examples/poem/opentelemetry-jaeger/src/server1.rs +++ b/examples/poem/opentelemetry-jaeger/src/server1.rs @@ -9,7 +9,6 @@ use opentelemetry_http::HeaderInjector; use opentelemetry_sdk::{propagation::TraceContextPropagator, trace::Tracer}; use poem::{ get, handler, - http::Method, listener::TcpListener, middleware::{OpenTelemetryMetrics, OpenTelemetryTracing}, web::Data, @@ -38,7 +37,7 @@ async fn index(tracer: Data<&Tracer>, body: String) -> String { let req = { let mut req = reqwest::Request::new( - Method::GET, + reqwest::Method::GET, Url::from_str("http://localhost:3002/api2").unwrap(), ); global::get_text_map_propagator(|propagator| { diff --git a/poem/src/listener/acme/client.rs b/poem/src/listener/acme/client.rs index 14f2e77c1a..b3c4b55fea 100644 --- a/poem/src/listener/acme/client.rs +++ b/poem/src/listener/acme/client.rs @@ -28,7 +28,7 @@ pub struct AcmeClient { impl AcmeClient { /// Create a new client. `directory_url` is the url for the ACME provider. `contacts` is a list /// of URLS (ex: `mailto:`) the ACME service can use to reach you if there's issues with your certificates. - pub(crate) async fn try_new(directory_url: &str, contacts: Vec) -> IoResult { + pub async fn try_new(directory_url: &str, contacts: Vec) -> IoResult { let client = Client::new(); let directory = get_directory(&client, directory_url).await?; Ok(Self {