Skip to content

Commit

Permalink
fixes networknt#1634 do not call the next handler in the chain if any…
Browse files Browse the repository at this point in the history
… intercep… (networknt#1635)

* fixes networknt#1634 do not call the next handler in the chain if any interceptor respond

* fixes networknt#1634 add a logging
  • Loading branch information
stevehu committed Mar 1, 2023
1 parent f8b13e9 commit 6c2a130
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,11 @@ public void handleRequest(HttpServerExchange httpServerExchange) throws Exceptio
// no need to inject the content for the body. just call the interceptors here.
this.invokeInterceptors(httpServerExchange);
}
Handler.next(httpServerExchange, next);
// If there are any error and one of the interceptor response the error to the caller, we don't need to call the next.
if(logger.isTraceEnabled()) logger.trace("Exchange response started status = {}", httpServerExchange.isResponseStarted());
if(!httpServerExchange.isResponseStarted()) {
Handler.next(httpServerExchange, next);
}
}

/**
Expand Down

0 comments on commit 6c2a130

Please sign in to comment.