bloody-request

1.0.1 • Public • Published

request

browser support

install

$ npm install bloody-request

require

var request = require("bloody-request")

api

request.create(params||url) > r

Creates a new request, accepts params as an object, or a simple url string with the default params.

  • headers : object (default null)
  • method : string (default "GET")
  • url : string (default null)
  • queryString : string (default null)
  • body : string (default null)
  • withCredentials : boolean (default false)

NOTE : a {"headerName":null} will cancel default headers.

request.load() > promise

Creates a XHR objects, and starts loading the target. Promise is fulfilled if 200 < status < 300 (or status = 304). Promise is rejected if status < 200 or if status status > 300 (not 304). The XHR object is passed as the value or the reason.

shorthands

  • request.get(url || options) > promise
  • request.post(url || options[, body]) > promise
  • request.put(url[, body] || options) > promise
  • request.del(url[, body] || options) > promise

events

returned promises have events you can listen to bloodyowl/promise

  • .on("resolve", cb)
  • .on("reject", cb)
  • .on("done", cb)
  • .on("error", cb)

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.1
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.1
    1
  • 1.0.0
    0
  • 0.1.2
    0
  • 0.1.1
    1
  • 0.1.0
    1

Package Sidebar

Install

npm i bloody-request

Weekly Downloads

3

Version

1.0.1

License

MIT

Last publish

Collaborators

  • bloodyowl