Socket
Book a DemoInstallSign in
Socket

http-utility

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

http-utility

A wrapper for handling events around http requests and responses.

latest
Source
npmnpm
Version
0.3.2
Version published
Maintainers
1
Created
Source

http-utility

A wrapper for handling events around http requests and responses. This includes the following events:

request.connect
request.error
request.finish
request.socket

response.data
response.end
response.error

socket.connection
socket.error
socket.timeout

Install

npm install http-utility

Usage

Get Method

var Http = require('http-utility'),
    // See http://nodejs.org/api/http.html#http_http_request_options_callback
    options = {
        host: 'your-host-name'
    },
    request;

request = Http.get(options, function callback (error, data) {
    // do something
});

Post Method

var Http = require('http-utility'),
    // See http://nodejs.org/api/http.html#http_http_request_options_callback
    options = {
        host: 'your-host-name',
        path: 'your/post/path',
        post_data: {data: "your data"},
        headers: {
            'Content-Type': 'your/content',
            'Content-Length': 'your-data-length'
        }
    },
    request;

request = Http.post(options, function callback (error, data) {
    // do something
});

Keywords

http

FAQs

Package last updated on 27 Jun 2014

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