Skip to content
This repository has been archived by the owner on May 8, 2018. It is now read-only.

Commit

Permalink
Merge pull request #80 from nodesecurity/send_version
Browse files Browse the repository at this point in the history
Send version
  • Loading branch information
wraithgar committed Mar 29, 2016
2 parents b011f2f + 1f032f9 commit 4f9e670
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ And finally run it
codeclimate analyze --dev
```

## Suggesting Changes to Advisories
Should you come across data in an advisory that you feel is wrong or is a false positive please let us know at [email protected]. We endeavor to make this process better in the future, however this is the best place to resolve these issues at the present.

## Contact

Node Security (+) is brought to you by [^lift security](https://liftsecurity.io).
Expand Down
10 changes: 9 additions & 1 deletion lib/check.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,15 @@ var Path = require('path');
var Wreck = require('wreck');
var PathIsAbsolute = require('path-is-absolute');

var Conf = require('rc')('nsp', { api: { baseUrl: 'https://api.nodesecurity.io', json: true } }, []);
var Conf = require('rc')('nsp', {
api: {
baseUrl: 'https://api.nodesecurity.io',
json: true,
headers: {
'X-NSP-VERSION': require('../package.json').version
}
}
}, []);

var internals = {};
internals.findLines = function (shrinkwrap, module, version) {
Expand Down
18 changes: 18 additions & 0 deletions test/unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ var Lab = require('lab');
var Nock = require('nock');
var Path = require('path');
var Check = require('../lib/check.js');
var Pkg = require('../package.json');

var lab = exports.lab = Lab.script();
var describe = lab.describe;
Expand Down Expand Up @@ -248,5 +249,22 @@ describe('check', function () {
});
});

it('Includes X-NSP-VERSION in headers', function (done) {

Nock('https://api.nodesecurity.io', {
reqheaders: {
'X-NSP-VERSION': Pkg.version
}
})
.post('/check')
.reply(200, Findings);

Check(workingOptions, function (err, results) {

expect(err).to.not.exist();
done();
});
});


});

0 comments on commit 4f9e670

Please sign in to comment.