Socket
Socket
Sign inDemoInstall

httpheaderprovider

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

httpheaderprovider

Replacement for HttpProvider from web3.js which allows headers to be set


Version published
Weekly downloads
12
increased by1100%
Maintainers
1
Weekly downloads
 
Created
Source

A Replacement Web3.js HttpProvider supporting Adding HTTP Headers

This module can be used in place of HttpProvider from web3.

Once in place, the constructor offers a headers parameter that is a key/value object that has the headers to be set.

Using

First you need to grab the package:

npm install --save httpheaderhrovider

In your JavaScript project

var Web3 = require('web3');
var web3 = new Web3();

var headerprovider = require('httpheaderprovider');

var headers = {
  "header1": "valueOf1",
  "header2": "valueOf2"
}
var provider = new headerprovider('http://localhost:8545', headers);

web3.setProvider(provider);

var coinbase = web3.eth.coinbase;
console.log(coinbase);

var balance = web3.eth.getBalance(coinbase);
console.log(balance.toString(10));

Keywords

FAQs

Package last updated on 04 Dec 2016

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

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