rob@77
|
1 # node-XMLHttpRequest #
|
rob@77
|
2
|
rob@77
|
3 node-XMLHttpRequest is a wrapper for the built-in http client to emulate the
|
rob@77
|
4 browser XMLHttpRequest object.
|
rob@77
|
5
|
rob@77
|
6 This can be used with JS designed for browsers to improve reuse of code and
|
rob@77
|
7 allow the use of existing libraries.
|
rob@77
|
8
|
rob@77
|
9 Note: This library currently conforms to [XMLHttpRequest 1](http://www.w3.org/TR/XMLHttpRequest/). Version 2.0 will target [XMLHttpRequest Level 2](http://www.w3.org/TR/XMLHttpRequest2/).
|
rob@77
|
10
|
rob@77
|
11 ## Usage ##
|
rob@77
|
12
|
rob@77
|
13 Here's how to include the module in your project and use as the browser-based
|
rob@77
|
14 XHR object.
|
rob@77
|
15
|
rob@77
|
16 var XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
|
rob@77
|
17 var xhr = new XMLHttpRequest();
|
rob@77
|
18
|
rob@77
|
19 Note: use the lowercase string "xmlhttprequest" in your require(). On
|
rob@77
|
20 case-sensitive systems (eg Linux) using uppercase letters won't work.
|
rob@77
|
21
|
rob@77
|
22 ## Versions ##
|
rob@77
|
23
|
rob@77
|
24 Prior to 1.4.0 version numbers were arbitrary. From 1.4.0 on they conform to
|
rob@77
|
25 the standard major.minor.bugfix. 1.x shouldn't necessarily be considered
|
rob@77
|
26 stable just because it's above 0.x.
|
rob@77
|
27
|
rob@77
|
28 Since the XMLHttpRequest API is stable this library's API is stable as
|
rob@77
|
29 well. Major version numbers indicate significant core code changes.
|
rob@77
|
30 Minor versions indicate minor core code changes or better conformity to
|
rob@77
|
31 the W3C spec.
|
rob@77
|
32
|
rob@77
|
33 ## License ##
|
rob@77
|
34
|
rob@77
|
35 MIT license. See LICENSE for full details.
|
rob@77
|
36
|
rob@77
|
37 ## Supports ##
|
rob@77
|
38
|
rob@77
|
39 * Async and synchronous requests
|
rob@77
|
40 * GET, POST, PUT, and DELETE requests
|
rob@77
|
41 * All spec methods (open, send, abort, getRequestHeader,
|
rob@77
|
42 getAllRequestHeaders, event methods)
|
rob@77
|
43 * Requests to all domains
|
rob@77
|
44
|
rob@77
|
45 ## Known Issues / Missing Features ##
|
rob@77
|
46
|
rob@77
|
47 For a list of open issues or to report your own visit the [github issues
|
rob@77
|
48 page](https://github.com/driverdan/node-XMLHttpRequest/issues).
|
rob@77
|
49
|
rob@77
|
50 * Local file access may have unexpected results for non-UTF8 files
|
rob@77
|
51 * Synchronous requests don't set headers properly
|
rob@77
|
52 * Synchronous requests freeze node while waiting for response (But that's what you want, right? Stick with async!).
|
rob@77
|
53 * Some events are missing, such as abort
|
rob@77
|
54 * getRequestHeader is case-sensitive
|
rob@77
|
55 * Cookies aren't persisted between requests
|
rob@77
|
56 * Missing XML support
|
rob@77
|
57 * Missing basic auth
|