Would you agree to support a track response support?
I am seeing a need to be able to apply track functionality based on response codes.
The possible use case I see is stats tracking of API calls by response code.
I am willing to provide a PR if you think it makes sense to integrate with rack-attack.
@flevour why should this be part of rack-attack instead of a separate HTTP code-tracking Rack middleware?
@flevour: Interesting. I'm hesitant to expand the track functionality to include responses. Adding tracks for requests was b/c it was such a close fit to how we're already blocking & throttling other requests.
For simplicity and focus, I'd like to keep parsing responses outside the scope of rack-attack. You could implementing response tracking as a separate middleware or gem (per @zmillman's suggesting).
In my case I'd want to throttle only successful requests to API over a given period. Basically I'm re-using the whole rack-attack count-over-period logic but to throttle responses. I see your point about simplicity/focus though, thanks for sharing your thoughts!