Are you happy with your logging solution? Would you help us out by taking a 30-second survey? Click here

shot

Injects a fake HTTP request/response into your node server logic

Subscribe to updates I use shot


Statistics on shot

Number of watchers on Github 163
Number of open issues 2
Average time to close an issue about 1 month
Main language JavaScript
Average time to merge a PR 5 days
Open pull requests 3+
Closed pull requests 12+
Last commit over 1 year ago
Repo Created almost 7 years ago
Repo Last Updated over 1 year ago
Size 212 KB
Organization / Authorhapijs
Contributors13
Page Updated
Do you use shot? Leave a review!
View open issues (2)
View shot activity
View on github
Fresh, new opensource launches 🚀🚀🚀
Trendy new open source projects in your inbox! View examples

Subscribe to our mailing list

Evaluating shot for your project? Score Explanation
Commits Score (?)
Issues & PR Score (?)

shot Logo

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).

Build Status

Lead Maintainer: Matt Harrison

Example

// Load modules

const Http = require('http');
const Shot = require('shot');


// Declare internals

const internals = {};


internals.main = 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);

    Shot.inject(dispatch, { method: 'get', url: '/' }, (res) => {

        console.log(res.payload);
    });
};


internals.main();

Note how server.listen is never called.

API

See the API Reference

shot open issues Ask a question     (View All Issues)
  • almost 3 years Add option to not read response into buffer, instead pass-through as stream
shot open pull requests (View All Pulls)
  • Adds quotes around node versions in travis file
  • Support stream payloads
  • Add socket property to request
shot questions on Stackoverflow (View All Questions)
  • Darken area of screen with Python (for a screen shot application)
  • Why is my partial screen shot blurry in swift?
  • My RelativeLayout doesn't fill the screen! (screen shot included)
  • Swift SpriteKit screen shot is stretched
  • How to Allocate Memory for a Bunch of Objects at One Shot?
  • How to Take Screen shot using HTMLUnit Driver selenium webdriver?
  • MYSQL - SELECT ALL COLUMNS different from zero in one shot
  • Message when user take screen shot by js
  • Custom dialog with softkeboard does not support Xiaomi Mi 4,( LoliPop ), as given code and screen shot bellow
  • How to take screen-shot of app screen in android?
  • Ansible: Trying to create multiple EC2 instances in multiple regions in one shot
  • Take Screen shot of TkInter-canvas as an image (jpg/png) in python
  • taking screen shot when button clicked by php
  • take a screen shot periodically
  • How to design a window form as in the attached screen shot?
  • How can I make screen shot image from MTKView in iOS? (Solved)
  • Retrieving last shot on Dribbble takes too long
  • How to get screen shot using php
  • Can not save screen shot bitmap to file using xlib
  • Save the Screen Shot as a jpeg in Windows 7 automatically (Background process to automatically save clipboard contents as a jpeg image file)
  • C# .NET How to capture (screen shot) external application's window without using unmanaged code (user32.dll)
  • How to take outer product of more than two matrices in one shot, in matlab?
  • Using javascript to take snap shot but the code below i want to save it to database
  • One shot event communication using std::future and valgrind
  • screen shot from html to canvas using html2canvas not working
  • iPhone in-app purchase screen shot
  • taking a screen shot of a specific area on the screen once every second
  • How can I switch the camera when I take a shot?
  • I would like to receive alert when web visitor takes screen shot from computer or mobile device. I don't need the contents of the screenshot
  • how to render the web browser and get x y coordinates of html tags(e.f. "<img", "<div", so on...) and take a screen shot them in C#?
shot list of languages used
Other projects in JavaScript