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

shot

Package Overview
Dependencies
Maintainers
3
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 3.2.1 to 3.3.0

42

lib/index.js

@@ -5,11 +5,49 @@ 'use strict';

const Hoek = require('hoek');
const Joi = require('joi');
const Request = require('./request');
const Response = require('./response');
const Schema = require('./schema');
// Declare internals
const internals = {};
internals.options = Joi.object().keys({
url: Joi.alternatives([
Joi.string(),
Joi.object().keys({
protocol: Joi.string(),
hostname: Joi.string(),
port: Joi.any(),
pathname: Joi.string().required(),
query: Joi.any()
})
])
.required(),
headers: Joi.object(),
payload: Joi.any(),
simulate: {
end: Joi.boolean(),
split: Joi.boolean(),
error: Joi.boolean(),
close: Joi.boolean()
},
authority: Joi.string(),
remoteAddress: Joi.string(),
method: Joi.string(),
validate: Joi.boolean()
});
exports.inject = function (dispatchFunc, options, callback) {
Joi.assert({ dispatchFunc, options, callback }, Schema);
options = (typeof options === 'string' ? { url: options } : options);
if (options.validate !== false) { // Defaults to true
Hoek.assert(typeof dispatchFunc === 'function', 'Invalid dispatch function');
Joi.assert(options, internals.options);
}
const req = new Request(options);

@@ -16,0 +54,0 @@ const res = new Response(req, callback);

3

lib/request.js

@@ -21,6 +21,3 @@ 'use strict';

options = (typeof options === 'string' ? { url: options } : options);
let url = options.url;
if (typeof url === 'object') {

@@ -27,0 +24,0 @@ url = Url.format(url);

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

@@ -6,0 +6,0 @@ "main": "lib/index.js",

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