From a7fb062aebec936c291359bdb33fd186d08ed4cb Mon Sep 17 00:00:00 2001 From: xxx Date: Sat, 25 Jul 2020 08:28:59 +0800 Subject: [PATCH] Add a method Finish(),which can stop the current handler immediately. --- context.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/context.go b/context.go index a9458833..2212f9c1 100644 --- a/context.go +++ b/context.go @@ -156,6 +156,11 @@ func (c *Context) FullPath() string { /*********** FLOW CONTROL ***********/ /************************************/ +// Finish will stop the current handler immediately. +func (c *Context) Finish() { + c.Request.Body.Close() +} + // Next should be used only inside middleware. // It executes the pending handlers in the chain inside the calling handler. // See example in GitHub.