Skip to content

Commit

Permalink
reemplazo send por end y envío el conent-type correcto
Browse files Browse the repository at this point in the history
  • Loading branch information
emilioplatzer committed Mar 27, 2016
1 parent 7ca83fa commit 5c97eb3
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 14 deletions.
8 changes: 5 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
language: node_js
node_js:
- "0.10"
- "0.11"
- "0.12"
- "0.12.7"
- "4.4.1"
- "5.9.1"
matrix:
fast_finish: true
allow_failures:
- node_js: "5.9.1"
script: "npm run-script test-ci"
after_script: "npm install coveralls@2.10.0 && cat ./coverage/lcov.info | coveralls"
7 changes: 4 additions & 3 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
environment:
matrix:
- nodejs_version: "0.10"
- nodejs_version: "0.11"
- nodejs_version: "0.12"
- nodejs_version: "4.4.1"
- nodejs_version: "5.9.1"
matrix:
allow_failures:
- nodejs_version: "0.11"
- nodejs_version: "5.9.1"
fast_finish: true
install:
- ps: Update-NodeJsInstallation (Get-NodeJsLatestBuild $env:nodejs_version)
Expand Down
8 changes: 6 additions & 2 deletions kill-9.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,19 @@ var kill9 = exports = module.exports = function kill9(opts){
res.status(opts.statusKilled||kill9.defaults.statusKilled);
if(opts.location){
res.header('Location',opts.location);
}else{
res.header('Content-Type', 'text/plain; charset=utf-8');
}
res.send(opts.messageKilled||'kill -9 success');
res.end(opts.messageKilled||'kill -9 success');
_process.exit(opts.exitCode||kill9.defaults.exitCode);
}else{
res.status(opts.statusBad||kill9.defaults.statusBad);
if(opts.locationBad){
res.header('Location',opts.locationBad);
}else{
res.header('Content-Type', 'text/plain; charset=utf-8');
}
res.send(opts.messageBad||'kill -9 unknown');
res.end(opts.messageBad||'kill -9 unknown');
}
});
return killer;
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
{
"name": "kill-9",
"description": "A way for kill node server from client navigator",
"version": "0.2.3",
"version": "0.3.0",
"author": "Emilio Platzer <emilioplatzer@outlook.com>",
"license": "GPL-2.0",
"repository": "codenautas/kill-9",
"main": "kill-9.js",
"dependencies": {
"express": ">=4.12.3"
"express": "~4.13.4"
},
"devDependencies": {
"istanbul": "0.3.13",
"mocha": "~2.2.4",
"supertest": "~0.15.0"
"istanbul": "~0.4.2",
"mocha": "~2.4.5",
"supertest": "~1.2.0"
},
"engines": {
"node": ">= 0.8.0"
"node": ">= 0.12.0"
},
"scripts": {
"test": "mocha --reporter spec --bail --check-leaks test/",
Expand Down
2 changes: 2 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ describe('kill9()', function(){
it('should kill if pid match', function(done){
request(server)
.get('/kill-9?pid=444')
.expect('Content-Type', 'text/plain; charset=utf-8')
.expect(200, "yeah'killed")
.end(function(err, res){
if (err) return done(err);
Expand All @@ -32,6 +33,7 @@ describe('kill9()', function(){
it('should not kill if pid not match', function(done){
request(server)
.get('/kill-9?pid=99')
.expect('Content-Type', 'text/plain; charset=utf-8')
.expect(404, 'kill -9 unknown', done);
});

Expand Down

0 comments on commit 5c97eb3

Please sign in to comment.