Node request implemented with XMLHttpRequest
Note this is a fork of jhs' browser-request compatible with IE8 and React Native.
Browser Request is a port of Mikeal Rogers's ubiquitous and excellent [request][req] package to the browser.
Jealous of Node.js? Pining for clever callbacks? Request is for you.
Don't care about Node.js? Looking for less tedium and a no-nonsense API? Request is for you too.
Fetch a resource:
Send a resource:
To work with JSON, set
true. Request will set the
Accept headers, and handle parsing and serialization.
Or, use this shorthand version (pass data into the
json option directly):
Browser Request provides a CouchDB wrapper. It is the same as the JSON wrapper, however it will indicate an error if the HTTP query was fine, but there was a problem at the database level. The most common example is
See the [Node.js Request README][req] for several more examples. Request intends to maintain feature parity with Node request (except what the browser disallows). If you find a discrepancy, please submit a bug report. Thanks!
Browser Request is a [browserify][browserify]-enabled package.
browser-request to your Node project
$ npm install browser-request
Next, make a module that uses the package.
// example.js - Example front-end (client-side) code using browser-request via browserify//var request =
To build this for the browser, run it through browserify.
$ browserify --entry example.js --outfile example-built.js
example-built.js to your web site and use it from your page.
<!-- Runs the request, outputs the result to the console -->
Browser Request is licensed under the Apache 2.0 license.