Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set default status code to 200 after goal exexuted #926

Merged
merged 1 commit into from
Sep 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 9 additions & 13 deletions crates/core/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,19 +227,15 @@ impl HyperHandler {
req.params = path_state.params;
// Set default status code before service hoops executed.
// We hope all hoops in service can get the correct status code.
let mut ctrl = if !hoops.is_empty() {
FlowCtrl::new(
[
&hoops[..],
&[Arc::new(DefaultStatusOK)],
&dm.hoops[..],
&[dm.goal],
]
.concat(),
)
} else {
FlowCtrl::new([&dm.hoops[..], &[dm.goal]].concat())
};
let mut ctrl = FlowCtrl::new(
[
&hoops[..],
&dm.hoops[..],
&[Arc::new(DefaultStatusOK)],
&[dm.goal],
]
.concat(),
);
ctrl.call_next(&mut req, &mut depot, &mut res).await;
// Set it to default status code again if any hoop set status code to None.
if res.status_code.is_none() {
Expand Down
Loading