{"_id":"browser-request","_rev":"87791","name":"browser-request","description":"Browser port of the Node.js 'request' package","dist-tags":{"latest":"0.3.3"},"maintainers":[{"name":"jhs","email":"jhs@iriscouch.com"},{"name":"maxogden","email":""}],"time":{"modified":"2021-06-03T10:28:32.000Z","created":"2011-12-21T16:05:28.968Z","0.3.3":"2014-11-24T09:03:27.924Z","0.3.2":"2014-07-16T07:01:30.474Z","0.3.1":"2013-10-11T02:29:46.258Z","0.3.0":"2013-10-11T02:26:27.409Z","0.2.1":"2013-02-07T07:09:03.326Z","0.2.0":"2012-03-30T06:16:19.613Z","0.1.0":"2011-12-29T08:08:00.535Z","0.1.0-beta2":"2011-12-21T16:26:29.624Z","0.1.0-beta1":"2011-12-21T16:05:28.968Z"},"users":{"zeke":true,"gregoryteach":true,"garthk":true,"filipedeschamps":true,"skozz":true,"9joneg":true,"ruchirgodura":true,"incendiary":true,"martianyi":true,"nonstopcoder":true,"pandao":true,"abuddington":true,"kingjulian":true,"nilz3ro":true,"philipjc":true,"hiztmine":true},"author":{"name":"Jason Smith","email":"jhs@iriscouch.com"},"repository":{"type":"git","url":"git://github.com/iriscouch/browser-request"},"versions":{"0.3.3":{"name":"browser-request","version":"0.3.3","author":{"name":"Jason Smith","email":"jhs@iriscouch.com"},"description":"Browser port of the Node.js 'request' package","keywords":["request","http","browser","browserify"],"homepage":"http://github.com/iriscouch/browser-request","repository":{"type":"git","url":"git://github.com/iriscouch/browser-request"},"scripts":{"test":"beefy test.js"},"devDependencies":{"tape":"~1.0.4","beefy":"~0.4.0","browserify":"~2.25.0"},"engines":["node"],"testling":{"files":"test.js","browsers":["ie/6..latest","firefox/3..5","firefox/19..nightly","chrome/4..7","chrome/24..canary","opera/10..next","safari/4..latest","iphone/6","ipad/6"]},"contributors":[{"name":"Jason Smith Work","email":"jhs@iriscouch.com"},{"name":"Jason Smith","email":"jason.h.smith@gmail.com"},{"name":"maxogden","email":"max@maxogden.com"},{"name":"Abbey Sparrow via Google","email":"abbeys@google.com"}],"bugs":{"url":"https://github.com/iriscouch/browser-request/issues"},"_id":"browser-request@0.3.3","dist":{"shasum":"9ece5b5aca89a29932242e18bf933def9876cc17","size":11024,"noattachment":false,"key":"/browser-request/-/browser-request-0.3.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/browser-request/download/browser-request-0.3.3.tgz"},"_from":".","_npmVersion":"1.3.24","_npmUser":{"name":"jhs","email":"jhs@iriscouch.com"},"maintainers":[{"name":"jhs","email":"jhs@iriscouch.com"},{"name":"maxogden","email":""}],"directories":{},"publish_time":1416819807924,"_cnpm_publish_time":1416819807924,"_hasShrinkwrap":false},"0.3.2":{"name":"browser-request","version":"0.3.2","author":{"name":"Jason Smith","email":"jhs@iriscouch.com"},"description":"Browser port of the Node.js 'request' package","keywords":["request","http","browser","browserify"],"homepage":"http://github.com/iriscouch/browser-request","repository":{"type":"git","url":"git://github.com/iriscouch/browser-request"},"scripts":{"test":"beefy test.js"},"devDependencies":{"tape":"~1.0.4","beefy":"~0.4.0","browserify":"~2.25.0"},"engines":["node"],"testling":{"files":"test.js","browsers":["ie/6..latest","firefox/3..5","firefox/19..nightly","chrome/4..7","chrome/24..canary","opera/10..next","safari/4..latest","iphone/6","ipad/6"]},"contributors":[{"name":"Jason Smith Work","email":"jhs@iriscouch.com"},{"name":"Jason Smith","email":"jason.h.smith@gmail.com"},{"name":"maxogden","email":"max@maxogden.com"}],"bugs":{"url":"https://github.com/iriscouch/browser-request/issues"},"_id":"browser-request@0.3.2","_shasum":"d2e574dccc2ea88de03a2be378b533576fd99620","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"jhs","email":"jason.h.smith@gmail.com"},"maintainers":[{"name":"jhs","email":"jhs@iriscouch.com"},{"name":"maxogden","email":""}],"dist":{"shasum":"d2e574dccc2ea88de03a2be378b533576fd99620","size":10590,"noattachment":false,"key":"/browser-request/-/browser-request-0.3.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/browser-request/download/browser-request-0.3.2.tgz"},"directories":{},"publish_time":1405494090474,"_cnpm_publish_time":1405494090474,"_hasShrinkwrap":false},"0.3.1":{"name":"browser-request","version":"0.3.1","author":{"name":"Jason Smith","email":"jhs@iriscouch.com"},"description":"Browser port of the Node.js 'request' package","keywords":["request","http","browser","browserify"],"homepage":"http://github.com/iriscouch/browser-request","repository":{"type":"git","url":"git://github.com/iriscouch/browser-request"},"scripts":{"test":"beefy test.js"},"devDependencies":{"tape":"~1.0.4","beefy":"~0.4.0","browserify":"~2.25.0"},"engines":["node"],"testling":{"files":"test.js","browsers":["ie/6..latest","firefox/3..5","firefox/19..nightly","chrome/4..7","chrome/24..canary","opera/10..next","safari/4..latest","iphone/6","ipad/6"]},"contributors":[{"name":"Jason Smith Work","email":"jhs@iriscouch.com"},{"name":"Jason Smith","email":"jason.h.smith@gmail.com"},{"name":"maxogden","email":"max@maxogden.com"}],"readmeFilename":"README.md","_id":"browser-request@0.3.1","dist":{"shasum":"4c01f0bda68de746a59e49db917558c9a583646f","size":9975,"noattachment":false,"key":"/browser-request/-/browser-request-0.3.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/browser-request/download/browser-request-0.3.1.tgz"},"_from":".","_npmVersion":"1.2.17","_npmUser":{"name":"jhs","email":"jhs@iriscouch.com"},"maintainers":[{"name":"jhs","email":"jhs@iriscouch.com"},{"name":"maxogden","email":""}],"directories":{},"publish_time":1381458586258,"_cnpm_publish_time":1381458586258,"_hasShrinkwrap":false},"0.3.0":{"name":"browser-request","version":"0.3.0","author":{"name":"Jason Smith","email":"jhs@iriscouch.com"},"description":"Browser port of the Node.js 'request' package","keywords":["request","http","browser","browserify"],"homepage":"http://github.com/iriscouch/browser-request","repository":{"type":"git","url":"git://github.com/iriscouch/browser-request"},"scripts":{"test":"beefy test.js"},"devDependencies":{"tape":"~1.0.4","beefy":"~0.4.0","browserify":"~2.25.0"},"engines":["node"],"testling":{"files":"test.js","browsers":["ie/6..latest","firefox/3..5","firefox/19..nightly","chrome/4..7","chrome/24..canary","opera/10..next","safari/4..latest","iphone/6","ipad/6"]},"readmeFilename":"README.md","_id":"browser-request@0.3.0","dist":{"shasum":"2c9b27006572b171f2e2f38e1b7ef476f6c28032","size":9881,"noattachment":false,"key":"/browser-request/-/browser-request-0.3.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/browser-request/download/browser-request-0.3.0.tgz"},"_from":".","_npmVersion":"1.2.17","_npmUser":{"name":"jhs","email":"jhs@iriscouch.com"},"maintainers":[{"name":"jhs","email":"jhs@iriscouch.com"},{"name":"maxogden","email":""}],"directories":{},"publish_time":1381458387409,"_cnpm_publish_time":1381458387409,"_hasShrinkwrap":false},"0.2.1":{"name":"browser-request","version":"0.2.1","author":{"name":"Jason Smith","email":"jhs@iriscouch.com"},"description":"Browser port of the Node.js 'request' package","keywords":["request","http","browser","ender","browserify"],"homepage":"http://github.com/iriscouch/browser-request","repository":{"type":"git","url":"git://github.com/iriscouch/browser-request"},"dependencies":{},"devDependencies":{"tap":"0.1.3","ender":"~0.8.2","static-plus":"~0.2.4","uglify-js":"~1.2.5","browserify":"~1.10.6"},"engines":["node"],"ender":"./dist/ender/ender.js","browserify":"./dist/ender/request.js","readmeFilename":"README.md","_id":"browser-request@0.2.1","dist":{"shasum":"fccb1156655e39021224df20584485e01c907b9d","size":64803,"noattachment":false,"key":"/browser-request/-/browser-request-0.2.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/browser-request/download/browser-request-0.2.1.tgz"},"_from":".","_npmVersion":"1.2.1","_npmUser":{"name":"jhs","email":"jhs@iriscouch.com"},"maintainers":[{"name":"jhs","email":"jhs@iriscouch.com"},{"name":"maxogden","email":""}],"directories":{},"publish_time":1360220943326,"_cnpm_publish_time":1360220943326,"_hasShrinkwrap":false},"0.2.0":{"name":"browser-request","version":"0.2.0","author":{"name":"Jason Smith","email":"jhs@iriscouch.com"},"description":"Browser port of the Node.js 'request' package","keywords":["request","http","browser","ender","browserify"],"homepage":"http://github.com/iriscouch/browser-request","repository":{"type":"git","url":"git://github.com/iriscouch/browser-request.git"},"dependencies":{},"devDependencies":{"tap":"0.1.3","ender":"~0.8.2","static-plus":"~0.2.4","uglify-js":"~1.2.5","browserify":"~1.10.6"},"engines":["node"],"ender":"./dist/ender/ender.js","browserify":"./dist/ender/request.js","_npmUser":{"name":"jhs","email":"jhs@iriscouch.com"},"_id":"browser-request@0.2.0","_engineSupported":true,"_npmVersion":"1.1.0-beta-4","_nodeVersion":"v0.6.6","_defaultsLoaded":true,"dist":{"shasum":"0ab38f5a42cebfed72edcaf992a0701deb0223b3","size":53973,"noattachment":false,"key":"/browser-request/-/browser-request-0.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/browser-request/download/browser-request-0.2.0.tgz"},"maintainers":[{"name":"jhs","email":"jhs@iriscouch.com"},{"name":"maxogden","email":""}],"directories":{},"publish_time":1333088179613,"_cnpm_publish_time":1333088179613,"_hasShrinkwrap":false},"0.1.0":{"name":"browser-request","version":"0.1.0","author":{"name":"Jason Smith","email":"jhs@iriscouch.com"},"description":"Browser port of the Node.js 'request' package","keywords":["request","http","browser","ender"],"homepage":"http://github.com/iriscouch/browser-request","repository":{"type":"git","url":"git://github.com/iriscouch/browser-request.git"},"dependencies":{},"devDependencies":{"tap":"0.1.3","ender":"~0.8.2"},"engines":["node"],"ender":"./dist/ender/ender.js","_npmUser":{"name":"jhs","email":"jhs@iriscouch.com"},"_id":"browser-request@0.1.0","_engineSupported":true,"_npmVersion":"1.1.0-beta-4","_nodeVersion":"v0.6.6","_defaultsLoaded":true,"dist":{"shasum":"db0f71781ee7467e7562697209f4a7392526bcb5","size":92573,"noattachment":false,"key":"/browser-request/-/browser-request-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/browser-request/download/browser-request-0.1.0.tgz"},"maintainers":[{"name":"jhs","email":"jhs@iriscouch.com"},{"name":"maxogden","email":""}],"directories":{},"publish_time":1325146080535,"_cnpm_publish_time":1325146080535,"_hasShrinkwrap":false},"0.1.0-beta2":{"name":"browser-request","version":"0.1.0-beta2","author":{"name":"Jason Smith","email":"jhs@iriscouch.com"},"description":"Browser port of the Node.js 'request' package","keywords":["request","http","browser","ender"],"homepage":"http://github.com/iriscouch/browser-request","repository":{"type":"git","url":"git://github.com/iriscouch/browser-request.git"},"dependencies":{},"devDependencies":{"tap":"0.1.3"},"engines":["node"],"ender":"./release/ender/ender.js","_npmUser":{"name":"jhs","email":"jhs@iriscouch.com"},"_id":"browser-request@0.1.0-beta2","_engineSupported":true,"_npmVersion":"1.1.0-beta-4","_nodeVersion":"v0.6.6","_defaultsLoaded":true,"dist":{"shasum":"48e942ec27b23e4149515d9aac3b44525e560e34","size":63594,"noattachment":false,"key":"/browser-request/-/browser-request-0.1.0-beta2.tgz","tarball":"http://registry.cnpm.dingdandao.com/browser-request/download/browser-request-0.1.0-beta2.tgz"},"maintainers":[{"name":"jhs","email":"jhs@iriscouch.com"},{"name":"maxogden","email":""}],"directories":{},"publish_time":1324484789624,"_cnpm_publish_time":1324484789624,"_hasShrinkwrap":false},"0.1.0-beta1":{"name":"browser-request","version":"0.1.0-beta1","author":{"name":"Jason Smith","email":"jhs@iriscouch.com"},"description":"Browser port of the Node.js 'request' package","keywords":["request","http","browser","ender"],"homepage":"http://github.com/iriscouch/browser-request","repository":{"type":"git","url":"git://github.com/iriscouch/browser-request.git"},"dependencies":{},"devDependencies":{"tap":"0.1.3"},"engines":["node"],"ender":"./build/ender/ender.js","_npmUser":{"name":"jhs","email":"jhs@iriscouch.com"},"_id":"browser-request@0.1.0-beta1","_engineSupported":true,"_npmVersion":"1.1.0-beta-4","_nodeVersion":"v0.6.6","_defaultsLoaded":true,"dist":{"shasum":"9db4fb96f089356f3024c65850867dc44f85be5a","size":57247,"noattachment":false,"key":"/browser-request/-/browser-request-0.1.0-beta1.tgz","tarball":"http://registry.cnpm.dingdandao.com/browser-request/download/browser-request-0.1.0-beta1.tgz"},"maintainers":[{"name":"jhs","email":"jhs@iriscouch.com"},{"name":"maxogden","email":""}],"directories":{},"publish_time":1324483528968,"_cnpm_publish_time":1324483528968,"_hasShrinkwrap":false}},"readme":"# Browser Request: The easiest HTTP library you'll ever see\n\nBrowser Request is a port of Mikeal Rogers's ubiquitous and excellent [request][req] package to the browser.\n\nJealous of Node.js? Pining for clever callbacks? Request is for you.\n\nDon't care about Node.js? Looking for less tedium and a no-nonsense API? Request is for you too.\n\n[![browser support](https://ci.testling.com/iriscouch/browser-request.png)](https://ci.testling.com/maxogden/browser-request)\n\n# Examples\n\nFetch a resource:\n\n```javascript\nrequest('/some/resource.txt', function(er, response, body) {\n  if(er)\n    throw er;\n  console.log(\"I got: \" + body);\n})\n```\n\nSend a resource:\n\n```javascript\nrequest.put({uri:'/some/resource.xml', body:'<foo><bar/></foo>'}, function(er, response) {\n  if(er)\n    throw new Error(\"XML PUT failed (\" + er + \"): HTTP status was \" + response.status);\n  console.log(\"Stored the XML\");\n})\n```\n\nTo work with JSON, set `options.json` to `true`. Request will set the `Content-Type` and `Accept` headers, and handle parsing and serialization.\n\n```javascript\nrequest({method:'POST', url:'/db', body:'{\"relaxed\":true}', json:true}, on_response)\n\nfunction on_response(er, response, body) {\n  if(er)\n    throw er\n  if(result.ok)\n    console.log('Server ok, id = ' + result.id)\n}\n```\n\nOr, use this shorthand version (pass data into the `json` option directly):\n\n```javascript\nrequest({method:'POST', url:'/db', json:{relaxed:true}}, on_response)\n```\n\n## Convenient CouchDB\n\nBrowser 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 `409 Conflict`.\n\n```javascript\nrequest.couch({method:'PUT', url:'/db/existing_doc', body:{\"will_conflict\":\"you bet!\"}}, function(er, resp, result) {\n  if(er.error === 'conflict')\n    return console.error(\"Couch said no: \" + er.reason); // Output: Couch said no: Document update conflict.\n\n  if(er)\n    throw er;\n\n  console.log(\"Existing doc stored. This must have been the first run.\");\n})\n```\n\nSee 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!\n\n# Usage\n\n## Browserify\n\nBrowser Request is a [browserify][browserify]-enabled package.\n\nFirst, add `browser-request` to your Node project\n\n    $ npm install browser-request\n\nNext, make a module that uses the package.\n\n```javascript\n// example.js - Example front-end (client-side) code using browser-request via browserify\n//\nvar request = require('browser-request')\nrequest('/', function(er, res) {\n  if(!er)\n    return console.log('browser-request got your root path:\\n' + res.body)\n\n  console.log('There was an error, but at least browser-request loaded and ran!')\n  throw er\n})\n```\n\nTo build this for the browser, run it through browserify.\n\n    $ browserify --entry example.js --outfile example-built.js\n\nDeploy `example-built.js` to your web site and use it from your page.\n\n```html\n  <script src=\"example-built.js\"></script> <!-- Runs the request, outputs the result to the console -->\n```\n\n## UMD\n\n`browser-request` is [UMD](https://github.com/umdjs/umd) wrapped, allowing you to serve it directly to the browser from wherever you store the module.\n\n```html\n  <script src=\"/node_modules/browser-request/index.js\"></script> <!-- Assigns the module to window.request -->\n```\n\nYou may also use an [AMD loader](http://requirejs.org/docs/whyamd.html) by referencing the same file in your loader [config](http://requirejs.org/docs/api.html#config).\n    \n## License\n\nBrowser Request is licensed under the Apache 2.0 license.\n\n","_attachments":{},"homepage":"http://github.com/iriscouch/browser-request","bugs":{"url":"https://github.com/iriscouch/browser-request/issues"}}