fix: Fix the incorrect usage of DisableReroute (#991)

This commit is contained in:
Kent Dong
2024-05-23 09:35:57 +08:00
committed by GitHub
parent 10f1adc730
commit 7fcb608fce

View File

@@ -70,6 +70,9 @@ func onHttpRequestHeader(ctx wrapper.HttpContext, pluginConfig config.PluginConf
ctx.SetContext(ctxKeyApiName, apiName)
if handler, ok := activeProvider.(provider.RequestHeadersHandler); ok {
// Disable the route re-calculation since the plugin may modify some headers related to the chosen route.
ctx.DisableReroute()
action, err := handler.OnRequestHeaders(ctx, apiName, log)
if err == nil {
return action
@@ -153,9 +156,6 @@ func onHttpResponseHeaders(ctx wrapper.HttpContext, pluginConfig config.PluginCo
ctx.BufferResponseBody()
}
// Disable the route re-calculation since the plugin may modify some headers related to the chosen route.
ctx.DisableReroute()
return types.ActionContinue
}