title: How to break-out of martini middleware
body: <p>In short, if I run some middleware for an <code>http.Request</code> and determine that the request deserves an HTTP 422, how can I "break-out" out of the middleware chain, and <em>return early</em> without invoking all of the middleware functions in the chain?</p>
  
  <p>For example, if I have this:</p>
  
  <pre><code>func Routes(m *martini.ClassicMartini) {
  
      m.Get("/cp/users", mw.AsJson, mw.RequestTimer, ctr.GetMany)
  
  }
  </code></pre>
  
  <p>if I call <code>return</code> in any of the middleware funds above, to my knowledge it will still invoke all of the middleware funds registered in the chain, so that <code>ctr.GetMany</code> is always invoked.</p>
  
  <p>is there some way to make the request/response as completed and tell martini to stop calling all the funcs in the chain?</p>
  
  <p>if the first return value is an integer, I guess martini assumes it's a status code. My current best guess is according to the docs:
  <a href="https://github.com/go-martini/martini#middleware-handlers" rel="nofollow noreferrer">https://github.com/go-martini/martini#middleware-handlers</a></p>
  
  <p>we could use this:</p>
  
  <pre><code>m.Use(func(c martini.Context, w http.ResponseWriter){
  
      if reqIsMalformed() {
          http.Error(w, "Bad request because xyz", 422)
          return;
      }
  
      c.Next()
  
  })
  </code></pre>
  
  <p>and if a condition was not met, we could just never call <code>c.Next()</code>?</p>