PR #34 accidentally changed behavior in the rate-limiting case by
moving the headers variable to a local scope, causing the ctx.throw
statement to throw an uncaught error. Fix that, and add a test line to
ensure we're throwing the expected error going forward.
Background: I have Raven set up to handle and report uncaught errors, hence updating koa-ratelimit to 4.1.0 resulted in error 500 instead of 429 when rate limiting hits.
PR #34 accidentally changed behavior in the rate-limiting case by moving the
headers
variable to a local scope, causing thectx.throw
statement to throw an uncaught error. Fix that, and add a test line to ensure we're throwing the expected error going forward.