-
Notifications
You must be signed in to change notification settings - Fork 0
/
package.json
48 lines (48 loc) · 3.74 KB
/
package.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
{
"name": "http-browserify",
"version": "1.7.0",
"description": "http module compatability for browserify",
"main": "index.js",
"browserify": "index.js",
"directories": {
"lib": ".",
"example": "example",
"test": "test"
},
"scripts": {
"test": "tape test/*.js"
},
"dependencies": {
"Base64": "~0.2.0",
"inherits": "~2.0.1"
},
"devDependencies": {
"ecstatic": "~0.1.6",
"tape": "~2.3.2"
},
"repository": {
"type": "git",
"url": "http://github.com/substack/http-browserify.git"
},
"keywords": [
"http",
"browserify",
"compatible",
"meatless",
"browser"
],
"author": {
"name": "James Halliday",
"email": "mail@substack.net",
"url": "http://substack.net"
},
"license": "MIT/X11",
"readme": "# http-browserify\n\nThe\n[http](http://nodejs.org/docs/v0.4.10/api/all.html#hTTP) module from node.js,\nbut for browsers.\n\nWhen you `require('http')` in\n[browserify](http://github.com/substack/node-browserify),\nthis module will be loaded.\n\n# example\n\n``` js\nvar http = require('http');\n\nhttp.get({ path : '/beep' }, function (res) {\n var div = document.getElementById('result');\n div.innerHTML += 'GET /beep<br>';\n \n res.on('data', function (buf) {\n div.innerHTML += buf;\n });\n \n res.on('end', function () {\n div.innerHTML += '<br>__END__';\n });\n});\n```\n\n# http methods\n\nvar http = require('http');\n\n## var req = http.request(opts, cb)\n\nwhere `opts` are:\n\n* `opts.method='GET'` - http method verb\n* `opts.path` - path string, example: `'/foo/bar?baz=555'`\n* `opts.headers={}` - as an object mapping key names to string or Array values\n* `opts.host=window.location.host` - http host\n* `opts.port=window.location.port` - http port\n* `opts.responseType` - response type to set on the underlying xhr object\n\nThe callback will be called with the response object.\n\n## var req = http.get(options, cb)\n\nA shortcut for\n\n``` js\noptions.method = 'GET';\nvar req = http.request(options, cb);\nreq.end();\n```\n\n# request methods\n\n## req.setHeader(key, value)\n\nSet an http header.\n\n## req.getHeader(key)\n\nGet an http header.\n\n## req.removeHeader(key)\n\nRemove an http header.\n\n## req.write(data)\n\nWrite some data to the request body.\n\nIf only 1 piece of data is written, `data` can be a FormData, Blob, or\nArrayBuffer instance. Otherwise, `data` should be a string or a buffer.\n\n## req.end(data)\n\nClose and send the request body, optionally with additional `data` to append.\n\n# response methods\n\n## res.getHeader(key)\n\nReturn an http header, if set. `key` is case-insensitive.\n\n# response attributes\n\n* res.statusCode, the numeric http response code\n* res.headers, an object with all lowercase keys\n\n# compatibility\n\nThis module has been tested and works with:\n\n* Internet Explorer 5.5, 6, 7, 8, 9\n* Firefox 3.5\n* Chrome 7.0\n* Opera 10.6\n* Safari 5.0\n\nMultipart streaming responses are buffered in all versions of Internet Explorer\nand are somewhat buffered in Opera. In all the other browsers you get a nice\nunbuffered stream of `\"data\"` events when you send down a content-type of\n`multipart/octet-stream` or similar.\n\n# protip\n\nYou can do:\n\n````javascript\nvar bundle = browserify({\n require : { http : 'http-browserify' }\n});\n````\n\nin order to map \"http-browserify\" over `require('http')` in your browserified\nsource.\n\n# install\n\nWith [npm](https://npmjs.org) do:\n\n```\nnpm install http-browserify\n```\n\n# license\n\nMIT\n",
"readmeFilename": "readme.markdown",
"bugs": {
"url": "https://github.com/substack/http-browserify/issues"
},
"homepage": "https://github.com/substack/http-browserify",
"_id": "http-browserify@1.7.0",
"_from": "http-browserify@^1.4.0"
}