Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught TypeError: stream.setEncoding is not a function #135

Open
iggi- opened this issue Sep 16, 2016 · 2 comments
Open

Uncaught TypeError: stream.setEncoding is not a function #135

iggi- opened this issue Sep 16, 2016 · 2 comments

Comments

@iggi-
Copy link

iggi- commented Sep 16, 2016

I am trying to use this inside of a ReactJS framework, however I am presented with the error in the title. It is throwing an error on Line 46 of the deserializer.js file.
https://github.com/baalexander/node-xmlrpc/blob/master/lib/deserializer.js#L46

Relevent ReactJS Code:
`export default class ViewUsers extends React.Component {
componentDidMount(){
var xmlrpc = require('xmlrpc');

var clientOps = {
        host: 'dev.example.com',
        port: 8443,
        path: '/dev/xmlrpc',
        basic_auth: {
            user: '[email protected]',
            pass: '123',
        }
};

var client = xmlrpc.createSecureClient(clientOps);
client.methodCall('view', ['3'], function (error, value) {
  if(error){
    console.log('error:', error);
    console.log('req headers:', error.req && error.req._header);
    console.log('res code:', error.res && error.res.statusCode);
    console.log('res body:', error.body);
  } else {
    console.log('value:', value);
  }
});

}
}
`

I just want to be able to get a successful call so I can display it in the render portion.

@iggi-
Copy link
Author

iggi- commented Sep 16, 2016

I was able to get past this by commenting out the two references to the setEncoding since I could not find the function specified in the SAX library and SAX defaults to UTF-8 which is what I need.

@drawm
Copy link

drawm commented Sep 23, 2016

Same problem here at work with cordova + react.
From what I can tell, response.setEncoding is available with nodejs but not with http-browserify

#135

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants