xhr version/package to use jsOAuth with node.js

58 views
Skip to first unread message

S James

unread,
Jul 16, 2012, 5:52:30 PM7/16/12
to jso...@googlegroups.com
Hi folks,

I'm trying to use jsOAuth in node.js. Right now I'm stumbling around line 810 of jsOAuth-1.3.4.js:

    /**                                                                                                                  
     * Factory object for XMLHttpRequest                                                                                 
     */
    function Request() {
        var XHR;
        if (typeof global.Titanium !== 'undefined' && typeof global.Titanium.Network.createHTTPClient != 'undefined') {
            XHR = global.Titanium.Network.createHTTPClient();
        } else if (typeof require !== 'undefined') {
            // CommonJS require                                                                                          
            try {
                XHR = new require('xhr').XMLHttpRequest();
            } catch (e) {
        [snip rest]

I'm not sure which node.js package to "require". The one installed by "npm install xhr" doesn't seem to have quite the right API.

Can anyone help here?

Many thanks in advance,
Seb James

               

Rob Griffiths

unread,
Jul 17, 2012, 4:09:14 AM7/17/12
to jso...@googlegroups.com
Hi Seb,

I think xhr has gone away. The one I've been using lately is w3c-xmlhttprequest

You can replace the line XHR = new require('xhr').XMLHttpRequest(); with XHR = new require('w3c-xmlhttprequest').XMLHttpRequest();


-- 
Rob Griffiths
Sent with Sparrow

Reply all
Reply to author
Forward
0 new messages