send-http-request

0.1.1 • Public • Published

send-http-request Build Status Dependency Status

Function that sends a HTTP request, returning a promise.

It uses XMLHTTPRequest, and will use the xmlhttprequest package in Node.js.

Usage

sendRequest = require("send-http-request")
sendRequest("GET","http://localhost/").then(
  function(response) { console.log(response) },
  function(error) { console.error(error) }
)

You may pass optional headers and data arguments. If only one extra parameter is given, it's assumed to be the headers object.

The response object has the following methods:

  • getText()
  • getStatusCode()
  • getHeader(name)

Credits

The initial structure of this module was generated by Jumpstart, using the Jumpstart Black Coffee template.

License

send-http-request is released under the MIT License.
Copyright (c) 2013 Meryn Stol

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.1.1
    0
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.1.1
    0
  • 0.1.0
    0

Package Sidebar

Install

npm i send-http-request

Weekly Downloads

0

Version

0.1.1

License

MIT

Last publish

Collaborators

  • meryn