You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What is the problem your feature solves, or the need it fulfills?
When using the HttpModule , I want to terminate the iteration and immediately return response. Currently, there is no clear way to stop the execution flow within the request_body_filter method and directly response back.
Describe the solution you'd like
I propose implementing a mechanism in the HttpModule to support immediate termination of the request flow and return a response. For example, within the request_body_filter method, if a cache hit is detected, the function should allow setting the response and halting further execution.
The code might look like this:
implHttpModuleforCacheContext{asyncfnrequest_body_filter(&mutself,body:&mutOption<Bytes>,_end_of_stream:bool,) -> Result<()>{ifletSome(cache) = Cache::global(){ifletOk(Some(cached_response)) = cache.try_cache(&self.query).await{info!("HIT! cached_response: {}", cached_response);let formatted_response =
cache.response_template.replace("%s",&cached_response);self.cached_response = Some(formatted_response);// Mechanism to terminate further processing and return cached response.}}Ok(())}}
Describe alternatives you've considered
Additional context
The text was updated successfully, but these errors were encountered:
We forked pingora internally, add new args Next to Pingora Filter. It works well. Maybe we can add next function like Koa/Gin framework.
But this require api breaking.
What is the problem your feature solves, or the need it fulfills?
When using the
HttpModule
, I want to terminate the iteration and immediately return response. Currently, there is no clear way to stop the execution flow within therequest_body_filter
method and directly response back.Describe the solution you'd like
I propose implementing a mechanism in the
HttpModule
to support immediate termination of the request flow and return a response. For example, within therequest_body_filter
method, if a cache hit is detected, the function should allow setting the response and halting further execution.The code might look like this:
Describe alternatives you've considered
Additional context
The text was updated successfully, but these errors were encountered: