node-oauth icon indicating copy to clipboard operation
node-oauth copied to clipboard

After request "response.setEncoding is not a function"

Open Crysp opened this issue 9 years ago • 1 comments

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 avatar Jan 04 '16 18:01 Crysp

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

https://github.com/dusnoki/node-oauth/commit/02733180f097c03676cbaafa9df36f93b0f44e1b

ericat avatar Mar 02 '16 11:03 ericat