Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

shot

Package Overview
Dependencies
Maintainers
2
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

shot - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

11

lib/index.js

@@ -39,4 +39,13 @@ // Load modules

var payload = options.payload || null;
if (payload &&
typeof payload !== 'string' &&
payload instanceof Buffer === false) {
payload = JSON.stringify(payload);
this.headers['content-type'] = this.headers['content-type'] || 'application/json';
}
this._shot = {
payload: options.payload || null,
payload: payload,
isDone: false,

@@ -43,0 +52,0 @@ simulate: options.simulate || {}

2

package.json
{
"name": "shot",
"description": "Injects a fake HTTP request/response into a node HTTP server",
"version": "1.0.0",
"version": "1.1.0",
"repository": "git://github.com/spumko/shot",

@@ -6,0 +6,0 @@ "main": "index",

@@ -272,2 +272,18 @@ // Load modules

});
it('echos object payload', function (done) {
var dispatch = function (req, res) {
res.writeHead(200, { 'content-type': req.headers['content-type'] });
req.pipe(res);
};
Shot.inject(dispatch, { method: 'post', url: '/test', payload: { a: 1 } }, function (res) {
expect(res.headers['content-type']).to.equal('application/json');
expect(res.payload).to.equal('{"a":1}');
done();
});
});
});

@@ -274,0 +290,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc