Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit test fixup #7

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ function (req, res, rate, limit, resetTime) {
function (req, res, rate, limit, resetTime, next) {

// HTTP code 420 from http://mehack.com/inventing-a-http-response-code-aka-seriously
res.json({error: 'Rate limit exceeded. Check headers for limit information.'}, {status: 420});
res.status(420).json({error: 'Rate limit exceeded. Check headers for limit information.'});
}
```

Expand Down Expand Up @@ -218,7 +218,7 @@ var headersMiddleware = rate.middleware(
onLimitReached: function (req, res, rate, limit, resetTime, next) {

// HTTP code 420 from http://mehack.com/inventing-a-http-response-code-aka-seriously
res.json({error: 'Rate limit exceeded. Check headers for limit information.'}, {status: 420});
res.status(420).json({error: 'Rate limit exceeded. Check headers for limit information.'});
}
});

Expand Down
4 changes: 2 additions & 2 deletions examples/simple-redis.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ var headersMiddleware = rate.middleware(
onLimitReached: function (req, res, rate, limit, resetTime, next) {

// HTTP code 420 from http://mehack.com/inventing-a-http-response-code-aka-seriously
res.json({error: 'Rate limit exceeded. Check headers for limit information.'}, {status: 420});
res.status(420).json({error: 'Rate limit exceeded. Check headers for limit information.'});
}
});

Expand All @@ -113,4 +113,4 @@ app.get('/headers', headersMiddleware, function(req, res){
res.send(text);
});

app.listen(3000);
app.listen(3000);
2 changes: 1 addition & 1 deletion lib/rate.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ exports.defaults = function () {
onLimitReached: function (req, res, rate, limit, resetTime, next) {

// HTTP code 420 from http://mehack.com/inventing-a-http-response-code-aka-seriously
res.json({error: 'Rate limit exceeded. Check headers for limit information.'}, {status: 420});
res.status(420).json({error: 'Rate limit exceeded. Check headers for limit information.'});
}

};
Expand Down
38 changes: 27 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
{ "name": "express-rate"
, "description": "Rate monitoring and limiting for express.js apps."
, "version": "0.0.1"
, "author": "Ilya Volodarsky <[email protected]>"
, "keywords": ["rate", "monitor", "limit", "monitoring", "performance"]
, "repository": "[email protected]:segmentio/express-rate.git"
, "main": "./index.js"
, "dependencies": { "redis": ">= 0.0.1" }
, "devDependencies": { "connect": "1.4.x" }
, "engines": { "node": ">= 0.1.98" }
}
{
"name": "express-rate",
"description": "Rate monitoring and limiting for express.js apps.",
"version": "0.0.1",
"author": "Ilya Volodarsky <[email protected]>",
"keywords": [
"rate",
"monitor",
"limit",
"monitoring",
"performance"
],
"repository": "[email protected]:segmentio/express-rate.git",
"main": "./index.js",
"dependencies": {
"redis": ">= 0.0.1"
},
"devDependencies": {
"express": ">= 4.7.0",
"async": "~0.9.0",
"chai": "~1.9.2",
"supertest": "~0.14.0"
},
"engines": {
"node": ">= 0.1.98"
}
}
Loading