New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

digger-network

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

digger-network

The contract / request and reply modules for digger

latest
Source
npmnpm
Version
0.0.2
Version published
Maintainers
1
Created
Source

digger-network

The contract / request and reply modules for digger

Request

A simple object that represents a HTTP request in JSON

var network = require('digger-network');

var req = network.request({
	method:'get',
	url:'/some/url'
})

req.setHeader('x-some-thing', '3434');

Response

An object representing a HTTP response - you can pass a function to be called when it has replied

var network = require('digger-network');

var res = network.response(function(){
	console.log('statuscode: ' + res.statusCode);	
	console.log('body: ' + res.body);
})

Or you can construct a response from raw JSON


var network = require('digger-network');

var res = network.response({
	statusCode:200,
	headers:{
		'content-type':'text/plain'
	},
	body:'hello digger'
}

Contract

A contract is an array of requests to be run as a batch either in series (a pipe contract) or in parallel (a merge contract).

Contracts are produced by running queries on digger containers - they are handled by the digger-contracts module

A contract representing posting data to 2 different places

var network = require('digger-network');

var contract = network.contract({
	method:'post',
	url:'/reception',
	headers:{
		'content-type':'digger/contract',
		'x-contract-type':'merge'
	},
	body:[{
		method:'post',
		url:'/some/database/path',
		body:'hello database 1'
	},{
		method:'post',
		url:'/some/other/path',
		body:'hello database 2'
	}]
}
})

Licence

MIT

Keywords

digger

FAQs

Package last updated on 06 Aug 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts