Skip to content

hrodic/golang-echo-simple-rate-limit-middleware

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

golang-echo-simple-rate-limit-middleware

Rate limit middleware for golang echo framework

Requirements

Usage

As any other middleware:

e := echo.New()
e.Use(RateLimitWithConfig(RateLimitConfig{
  Limit: 2,
  Burst: 2,
}))

run your server and try out the middleware easily with curl

while true; do curl https://localhost:8080 --insecure; done

responses

...
...
...
HTTP/2 200 
access-control-allow-origin: 
content-type: application/json; charset=UTF-8
vary: Accept-Encoding
vary: Origin
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
x-request-id: eVdqddyz8XHFJ2UgDjlOb7QbfY23Hfyi
x-xss-protection: 1; mode=block
content-length: 32
date: Sat, 17 Aug 2019 13:59:49 GMT

{"application":"","version":""}
HTTP/2 429 
content-type: application/json; charset=UTF-8
content-length: 32
date: Sat, 17 Aug 2019 13:59:49 GMT

{"message":"Too Many Requests"}

Releases

No releases published

Packages

No packages published

Languages