Skip to content

Commit 4f63686

Browse files
authored
Merge pull request #2489 from itowlson/fix-chained-request-base
Fix incorrect base passed in service chaining
2 parents 8454856 + 9d2c79f commit 4f63686

File tree

2 files changed

+7
-7
lines changed
  • crates/trigger-http/src
  • tests/test-components/components/internal-http-middle/src

2 files changed

+7
-7
lines changed

crates/trigger-http/src/lib.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,7 @@ impl HttpRuntimeData {
582582
let engine = chained_handler.engine;
583583
let handler = chained_handler.executor;
584584

585+
let base = "/";
585586
let route_match = RouteMatch::synthetic(&component_id, request.request.uri().path());
586587

587588
let client_addr = std::net::SocketAddr::from_str("0.0.0.0:0")?;
@@ -595,13 +596,7 @@ impl HttpRuntimeData {
595596

596597
let resp_fut = async move {
597598
match handler
598-
.execute(
599-
engine.clone(),
600-
&component_id,
601-
&route_match,
602-
req,
603-
client_addr,
604-
)
599+
.execute(engine.clone(), base, &route_match, req, client_addr)
605600
.await
606601
{
607602
Ok(resp) => Ok(Ok(IncomingResponseInternal {

tests/test-components/components/internal-http-middle/src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ async fn handle_middle_impl(req: Request) -> Result<impl IntoResponse, String> {
1616
.header("spin-path-info")
1717
.and_then(|v| v.as_str());
1818
let inbound_rel_path = ensure_some!(inbound_rel_path);
19+
let inbound_base = req
20+
.header("spin-base-path")
21+
.and_then(|v| v.as_str());
22+
ensure_eq!("/", ensure_some!(inbound_base));
23+
1924
let out_req = spin_sdk::http::Request::builder()
2025
.uri("https://back.spin.internal/hello/from/middle")
2126
.method(spin_sdk::http::Method::Post)

0 commit comments

Comments
 (0)