Giter Site home page Giter Site logo

Comments (7)

mseminatore avatar mseminatore commented on July 28, 2024 2

@roopesh Returning (error, body, response) would be non-standard behavior for a Node library so that is a non-starter. However body is already fully contained within response so only response would need to be returned.

Changing the return parameters to the node-back would be a breaking change to the API and so per semver rules that cannot be considered for 2.x. I will however consider it for 3.x. Please feel free to elaborate on what you'd like to see if it is different than what I just described.

from teslajs.

mseminatore avatar mseminatore commented on July 28, 2024

@roopesh Can you elaborate on your issue a little bit further? All API's take a standard Node-style callback which returns (error, data) to the callback function. Are you asking to return the body instead of the response? And are you asking to return an error or data but not both?

from teslajs.

roopesh avatar roopesh commented on July 28, 2024

So when I send in an invalid token I don't get an error object back. In fact the node instance was creating because there wasn't a response in the data. The only way to know what was happening was to get the response and check the statusCode. I could see the 401.

So in my local version I return error, response, and body to interpret the call's output.

from teslajs.

roopesh avatar roopesh commented on July 28, 2024

Oops. The node instance was crashing.

from teslajs.

roopesh avatar roopesh commented on July 28, 2024

That works for me. I'll update mine to return response, too, and see if it works.

from teslajs.

roopesh avatar roopesh commented on July 28, 2024

That works. I'm now just getting the error, response back from the POST (I'm going to change the GET to the same thing) and I can get to the body from there.

Thank you!

from teslajs.

mseminatore avatar mseminatore commented on July 28, 2024

@roopesh You are welcome! Hope the library works for your needs.

from teslajs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.