Skip to content

Commit 30f2e1e

Browse files
authored
Merge pull request #2823 from fermyon/no-socket-addr-self-origin
Don't require a `SocketAddr` to make a `SelfRequestOrigin`
2 parents 13d6299 + a34c8a3 commit 30f2e1e

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

crates/factor-outbound-http/src/lib.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ mod wasi;
44
pub mod wasi_2023_10_18;
55
pub mod wasi_2023_11_10;
66

7-
use std::{net::SocketAddr, sync::Arc};
7+
use std::sync::Arc;
88

99
use anyhow::Context;
1010
use http::{
@@ -138,13 +138,12 @@ pub struct SelfRequestOrigin {
138138
}
139139

140140
impl SelfRequestOrigin {
141-
pub fn create(scheme: Scheme, addr: &SocketAddr) -> anyhow::Result<Self> {
141+
pub fn create(scheme: Scheme, auth: &str) -> anyhow::Result<Self> {
142142
Ok(SelfRequestOrigin {
143143
scheme,
144-
authority: addr
145-
.to_string()
144+
authority: auth
146145
.parse()
147-
.with_context(|| format!("address '{addr}' is not a valid authority"))?,
146+
.with_context(|| format!("address '{auth}' is not a valid authority"))?,
148147
})
149148
}
150149

crates/trigger-http/src/server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ impl<F: RuntimeFactors> HttpServer<F> {
244244
.context(
245245
"The wasi HTTP trigger was configured without the required wasi outbound http support",
246246
)?;
247-
let origin = SelfRequestOrigin::create(server_scheme, &self.listen_addr)?;
247+
let origin = SelfRequestOrigin::create(server_scheme, &self.listen_addr.to_string())?;
248248
outbound_http.set_self_request_origin(origin);
249249
outbound_http.set_request_interceptor(OutboundHttpInterceptor::new(self.clone()))?;
250250

0 commit comments

Comments
 (0)