mirror of
https://github.com/samsonjs/rack-attack.git
synced 2026-03-25 09:25:49 +00:00
Merge branch '6-stable'
This commit is contained in:
commit
fe5deb9093
1 changed files with 11 additions and 0 deletions
11
README.md
11
README.md
|
|
@ -37,6 +37,7 @@ See the [Backing & Hacking blog post](https://www.kickstarter.com/backing-and-ha
|
|||
- [Customizing responses](#customizing-responses)
|
||||
- [RateLimit headers for well-behaved clients](#ratelimit-headers-for-well-behaved-clients)
|
||||
- [Logging & Instrumentation](#logging--instrumentation)
|
||||
- [Testing](#testing)
|
||||
- [How it works](#how-it-works)
|
||||
- [About Tracks](#about-tracks)
|
||||
- [Testing](#testing)
|
||||
|
|
@ -393,6 +394,16 @@ ActiveSupport::Notifications.subscribe(/rack_attack/) do |name, start, finish, r
|
|||
end
|
||||
```
|
||||
|
||||
## Testing
|
||||
|
||||
### Disabling
|
||||
|
||||
`Rack::Attack.enabled = false` can be used to either completely disable Rack::Attack in your tests, or to disable/enable for specific test cases only.
|
||||
|
||||
### Test case isolation
|
||||
|
||||
`Rack::Attack.reset!` can be used in your test suite to clear any Rack::Attack state between different test cases.
|
||||
|
||||
## How it works
|
||||
|
||||
The Rack::Attack middleware compares each request against *safelists*, *blocklists*, *throttles*, and *tracks* that you define. There are none by default.
|
||||
|
|
|
|||
Loading…
Reference in a new issue