@hapi/shot
Advanced tools
Comparing version 4.1.2 to 5.0.0
@@ -1,2 +0,2 @@ | ||
Copyright (c) 2012-2019, Sideway Inc, and project contributors | ||
Copyright (c) 2012-2020, Sideway Inc, and project contributors | ||
Copyright (c) 2012-2014, Walmart. | ||
@@ -3,0 +3,0 @@ All rights reserved. |
{ | ||
"name": "@hapi/shot", | ||
"description": "Injects a fake HTTP request/response into a node HTTP server", | ||
"version": "4.1.2", | ||
"version": "5.0.0", | ||
"repository": "git://github.com/hapijs/shot", | ||
"main": "lib/index.js", | ||
"files": [ | ||
"lib" | ||
], | ||
"keywords": [ | ||
@@ -14,8 +17,8 @@ "utilities", | ||
"dependencies": { | ||
"@hapi/hoek": "8.x.x", | ||
"@hapi/joi": "16.x.x" | ||
"@hapi/hoek": "9.x.x", | ||
"@hapi/joi": "17.x.x" | ||
}, | ||
"devDependencies": { | ||
"@hapi/code": "6.x.x", | ||
"@hapi/lab": "20.x.x" | ||
"@hapi/code": "8.x.x", | ||
"@hapi/lab": "22.x.x" | ||
}, | ||
@@ -22,0 +25,0 @@ "scripts": { |
@@ -1,43 +0,17 @@ | ||
<a href="http://hapijs.com"><img src="https://raw.githubusercontent.com/hapijs/assets/master/images/family.png" width="180px" align="right" /></a> | ||
<a href="https://hapi.dev"><img src="https://raw.githubusercontent.com/hapijs/assets/master/images/family.png" width="180px" align="right" /></a> | ||
# shot | ||
# @hapi/shot | ||
Injects a fake HTTP request/response into a node HTTP server for simulating server logic, writing tests, or debugging. Does not use a socket | ||
connection so can be run against an inactive server (server not in listen mode). | ||
#### Injects a fake HTTP request/response into your node server logic. | ||
[![Build Status](https://secure.travis-ci.org/hapijs/shot.png)](http://travis-ci.org/hapijs/shot) | ||
**shot** is part of the **hapi** ecosystem and was designed to work seamlessly with the [hapi web framework](https://hapi.dev) and its other components (but works great on its own or with other frameworks). If you are using a different web framework and find this module useful, check out [hapi](https://hapi.dev) – they work even better together. | ||
## Example | ||
### Visit the [hapi.dev](https://hapi.dev) Developer Portal for tutorials, documentation, and support | ||
```javascript | ||
const Http = require('http'); | ||
const Shot = require('@hapi/shot'); | ||
## Useful resources | ||
const internals = {}; | ||
internals.main = async function () { | ||
const dispatch = function (req, res) { | ||
const reply = 'Hello World'; | ||
res.writeHead(200, { 'Content-Type': 'text/plain', 'Content-Length': reply.length }); | ||
res.end(reply); | ||
}; | ||
const server = Http.createServer(dispatch); | ||
const res = await Shot.inject(dispatch, { method: 'get', url: '/' }); | ||
console.log(res.payload); | ||
}; | ||
internals.main(); | ||
``` | ||
Note how `server.listen` is never called. | ||
## API | ||
See the [API Reference](API.md) | ||
- [Documentation and API](https://hapi.dev/family/shot/) | ||
- [Versions status](https://hapi.dev/resources/status/#shot) (builds, dependencies, node versions, licenses, eol) | ||
- [Changelog](https://hapi.dev/family/shot/changelog/) | ||
- [Project policies](https://hapi.dev/policies/) | ||
- [Free and commercial support options](https://hapi.dev/support/) |
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
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
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
0
13310
8
18
+ Added@hapi/address@4.1.0(transitive)
+ Added@hapi/formula@2.0.0(transitive)
+ Added@hapi/hoek@9.3.0(transitive)
+ Added@hapi/joi@17.1.1(transitive)
+ Added@hapi/pinpoint@2.0.1(transitive)
+ Added@hapi/topo@5.1.0(transitive)
- Removed@hapi/address@2.1.4(transitive)
- Removed@hapi/formula@1.2.0(transitive)
- Removed@hapi/hoek@8.5.1(transitive)
- Removed@hapi/joi@16.1.8(transitive)
- Removed@hapi/pinpoint@1.0.2(transitive)
- Removed@hapi/topo@3.1.6(transitive)
Updated@hapi/hoek@9.x.x
Updated@hapi/joi@17.x.x