github.com/dbernstein1/tyk@v2.9.0-beta9-dl-apic+incompatible/gateway/mw_rate_check.go (about)

     1  package gateway
     2  
     3  import (
     4  	"net/http"
     5  )
     6  
     7  type RateCheckMW struct {
     8  	BaseMiddleware
     9  }
    10  
    11  func (m *RateCheckMW) Name() string {
    12  	return "RateCheckMW"
    13  }
    14  
    15  func (m *RateCheckMW) ProcessRequest(w http.ResponseWriter, r *http.Request, _ interface{}) (error, int) {
    16  	// Let's track r/ps
    17  	GlobalRate.Incr(1)
    18  	return nil, http.StatusOK
    19  }