1.0.1 • Published 12 years ago
bloody-request v1.0.1
request
install
$ npm install bloody-requestrequire
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 (defaultnull)method: string (default"GET")url: string (defaultnull)queryString: string (defaultnull)body: string (defaultnull)withCredentials: boolean (defaultfalse)
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) > promiserequest.post(url || options[, body]) > promiserequest.put(url[, body] || options) > promiserequest.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)
