Socket
Socket
Sign inDemoInstall

@hapi/shot

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hapi/shot - npm Package Compare versions

Comparing version 4.1.2 to 5.0.0

2

LICENSE.md

@@ -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/)
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