Skip to content

Commit

Permalink
proxy: Insert to existing headers and allow to call rest handlers (#660)
Browse files Browse the repository at this point in the history
* proxy: Extend existing headers and allow to call rest handlers

* done
  • Loading branch information
chrislearn authored Jan 20, 2024
1 parent dfbe2b0 commit 89b36ab
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions crates/proxy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ where
U::Error: Into<BoxedError>,
C: Client,
{
async fn handle(&self, req: &mut Request, depot: &mut Depot, res: &mut Response, ctrl: &mut FlowCtrl) {
async fn handle(&self, req: &mut Request, depot: &mut Depot, res: &mut Response, _ctrl: &mut FlowCtrl) {
match self.build_proxied_request(req, depot).await {
Ok(proxied_request) => {
match self
Expand All @@ -282,7 +282,11 @@ where
body,
) = response.into_parts();
res.status_code(status);
res.set_headers(headers);
for (name, value) in headers {
if let Some(name) = name {
res.headers.insert(name, value);
}
}
res.body(body);
}
Err(e) => {
Expand All @@ -295,10 +299,6 @@ where
tracing::error!(error = ?e, "build proxied request failed");
}
}
if ctrl.has_next() {
tracing::error!("all handlers after proxy will skipped");
ctrl.skip_rest();
}
}
}
#[inline]
Expand Down

0 comments on commit 89b36ab

Please sign in to comment.