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.4.2 to 1.5.0

8

lib/index.js

@@ -62,2 +62,10 @@ // Load modules

// Set the content-length for the corresponding payload if none set
if (payload &&
!this.headers.hasOwnProperty('content-length')) {
this.headers['content-length'] = (Buffer.isBuffer(payload) ? payload.length : Buffer.byteLength(payload)).toString();
}
this._shot = {

@@ -64,0 +72,0 @@ payload: payload,

2

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

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

@@ -8,3 +8,3 @@ ![shot Logo](https://raw.github.com/hapijs/shot/master/images/shot.png)

Lead Maintainer: [Chris Dickinson](https://github.com/chrisdickinson)
Lead Maintainer: [Eran Hammer](https://github.com/hueniverse)

@@ -11,0 +11,0 @@ For example:

@@ -376,2 +376,34 @@ // Load modules

});
it('adds a content-length header if none set when payload specified', function (done) {
var dispatch = function (req, res) {
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end(req.headers['content-length']);
};
Shot.inject(dispatch, { method: 'post', url: '/test', payload: { a: 1 } }, function (res) {
expect(res.payload).to.equal('{"a":1}'.length.toString());
done();
});
});
it('retains a content-length header when payload specified', function (done) {
var dispatch = function (req, res) {
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end(req.headers['content-length']);
};
Shot.inject(dispatch, { method: 'post', url: '/test', payload: '', headers: { 'content-length': '10' } }, function (res) {
expect(res.payload).to.equal('10');
done();
});
});
});

@@ -378,0 +410,0 @@

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