ciaranj/node-oauth

After request "response.setEncoding is not a function"

Opened this issue · 1 comments

Crysp commented

Hi. I tried to run basic example and it returns an error response.setEncoding is not a function. It fails here.

May be it important, i used webpack to build my js.

var OAuth = require('oauth').OAuth;

module.exports = (function () {

    var oauthClient = new OAuth(
        'https://api.twitter.com/oauth/request_token',
        'https://api.twitter.com/oauth/access_token',
        'xxx',
        'xxx',
        '1.0A',
        null,
        'HMAC-SHA1'
    );

    oauthClient.get(
        'https://api.twitter.com/1.1/trends/place.json?id=23424977',
        'xxx', //test user token
        'xxx', //test user secret
        function (e, data, res){
            if (e) console.error(e);
            console.log(require('util').inspect(data));
        }
    );

}());

@Crysp below the fix, there is a PR which hasn't been merged yet, hopefully it will happen asap.

dusnoki@0273318