reset http context
@@ -57,7 +57,7 @@ type HttpContext struct {
HttpConnectionManager model.HttpConnectionManager
Listener *model.Listener
Route *model.RouteAction
- Api router.API
+ Api *router.API
Request *http.Request
writermem responseWriter
@@ -89,7 +89,15 @@ func (hc *HttpContext) Next() {
// Reset reset http context
func (hc *HttpContext) Reset() {
hc.Writer = &hc.writermem
+ hc.Ctx = nil
hc.Index = -1
+ hc.Filters = []FilterFunc{}
+ hc.Route = nil
+ hc.Api = nil
+ hc.Err = nil
+
+ hc.TargetResp = nil
+ hc.SourceResp = nil
}
// Status set header status code
@@ -240,12 +248,12 @@ func (hc *HttpContext) ResetWritermen(w http.ResponseWriter) {
// API sets the API to http context
func (hc *HttpContext) API(api router.API) {
hc.Timeout = api.Timeout
- hc.Api = api
+ hc.Api = &api
}
// GetAPI get api
func (hc *HttpContext) GetAPI() *router.API {
- return &hc.Api
+ return hc.Api
}
// Abort filter chain break , filter after the current filter will not executed.
