@hapi/shot
Advanced tools
Comparing version 5.0.0 to 5.0.1
'use strict'; | ||
const Hoek = require('@hapi/hoek'); | ||
const Joi = require('@hapi/joi'); | ||
const Validate = require('@hapi/validate'); | ||
@@ -14,26 +14,26 @@ const Request = require('./request'); | ||
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() | ||
internals.options = Validate.object().keys({ | ||
url: Validate.alternatives([ | ||
Validate.string(), | ||
Validate.object().keys({ | ||
protocol: Validate.string(), | ||
hostname: Validate.string(), | ||
port: Validate.any(), | ||
pathname: Validate.string().required(), | ||
query: Validate.any() | ||
}) | ||
]) | ||
.required(), | ||
headers: Joi.object(), | ||
payload: Joi.any(), | ||
headers: Validate.object(), | ||
payload: Validate.any(), | ||
simulate: { | ||
end: Joi.boolean(), | ||
split: Joi.boolean(), | ||
error: Joi.boolean(), | ||
close: Joi.boolean() | ||
end: Validate.boolean(), | ||
split: Validate.boolean(), | ||
error: Validate.boolean(), | ||
close: Validate.boolean() | ||
}, | ||
authority: Joi.string(), | ||
remoteAddress: Joi.string(), | ||
method: Joi.string(), | ||
validate: Joi.boolean() | ||
authority: Validate.string(), | ||
remoteAddress: Validate.string(), | ||
method: Validate.string(), | ||
validate: Validate.boolean() | ||
}); | ||
@@ -49,3 +49,3 @@ | ||
Hoek.assert(typeof dispatchFunc === 'function', 'Invalid dispatch function'); | ||
Joi.assert(options, internals.options); | ||
Validate.assert(options, internals.options); | ||
} | ||
@@ -52,0 +52,0 @@ catch (err) { |
'use strict'; | ||
const Joi = require('@hapi/joi'); | ||
const Validate = require('@hapi/joi'); | ||
@@ -9,31 +9,31 @@ | ||
internals.url = Joi.alternatives(Joi.string().required(), Joi.object().keys({ | ||
protocol: Joi.string(), | ||
hostname: Joi.string(), | ||
port: Joi.any(), | ||
pathname: Joi.string().required(), | ||
query: Joi.any() | ||
internals.url = Validate.alternatives(Validate.string().required(), Validate.object().keys({ | ||
protocol: Validate.string(), | ||
hostname: Validate.string(), | ||
port: Validate.any(), | ||
pathname: Validate.string().required(), | ||
query: Validate.any() | ||
}).required()); | ||
internals.options = Joi.object().keys({ | ||
internals.options = Validate.object().keys({ | ||
url: internals.url.required(), | ||
headers: Joi.object(), | ||
payload: Joi.any(), | ||
simulate: Joi.object().keys({ | ||
end: Joi.boolean(), | ||
split: Joi.boolean(), | ||
error: Joi.boolean(), | ||
close: Joi.boolean() | ||
headers: Validate.object(), | ||
payload: Validate.any(), | ||
simulate: Validate.object().keys({ | ||
end: Validate.boolean(), | ||
split: Validate.boolean(), | ||
error: Validate.boolean(), | ||
close: Validate.boolean() | ||
}), | ||
authority: Joi.string(), | ||
remoteAddress: Joi.string(), | ||
method: Joi.string().regex(/^[a-zA-Z0-9!#\$%&'\*\+\-\.^_`\|~]+$/) | ||
authority: Validate.string(), | ||
remoteAddress: Validate.string(), | ||
method: Validate.string().regex(/^[a-zA-Z0-9!#\$%&'\*\+\-\.^_`\|~]+$/) | ||
}).min(1); | ||
module.exports = Joi.object().keys({ | ||
dispatchFunc: Joi.func().required(), | ||
options: Joi.alternatives(internals.options, internals.url).required(), | ||
callback: Joi.func() | ||
module.exports = Validate.object().keys({ | ||
dispatchFunc: Validate.func().required(), | ||
options: Validate.alternatives(internals.options, internals.url).required(), | ||
callback: Validate.func() | ||
}); |
{ | ||
"name": "@hapi/shot", | ||
"description": "Injects a fake HTTP request/response into a node HTTP server", | ||
"version": "5.0.0", | ||
"version": "5.0.1", | ||
"repository": "git://github.com/hapijs/shot", | ||
@@ -18,7 +18,7 @@ "main": "lib/index.js", | ||
"@hapi/hoek": "9.x.x", | ||
"@hapi/joi": "17.x.x" | ||
"@hapi/validate": "1.x.x" | ||
}, | ||
"devDependencies": { | ||
"@hapi/code": "8.x.x", | ||
"@hapi/lab": "22.x.x" | ||
"@hapi/lab": "23.x.x" | ||
}, | ||
@@ -25,0 +25,0 @@ "scripts": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13544
2
+ Added@hapi/validate@1.x.x
+ Added@hapi/validate@1.1.3(transitive)
- Removed@hapi/joi@17.x.x
- Removed@hapi/address@4.1.0(transitive)
- Removed@hapi/formula@2.0.0(transitive)
- Removed@hapi/joi@17.1.1(transitive)
- Removed@hapi/pinpoint@2.0.1(transitive)