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

A couple of issues I noticed #4

Open
bellostom opened this issue Dec 15, 2011 · 2 comments
Open

A couple of issues I noticed #4

bellostom opened this issue Dec 15, 2011 · 2 comments

Comments

@bellostom
Copy link

Hi

Just wanted to mention some issues I noticed

  1. You should add the Content-Type: application/json to the headers you send

  2. When you decode the server's response and you check for the result key in the object, you then call

callback(null, decoded.result);

but if you find the error key you invoke the callback as

callback(decoded.error);

Why would you send the null?

Why not just use

callback(response)

Other than these, great work

@zeisss
Copy link

zeisss commented Dec 15, 2011

Regarding the second 2. point: I think the current way is ok. Because the callback can then look like this:

function(err, result) { ... }

which is exactly the same ways as the current node.js API looks like.

@bellostom
Copy link
Author

No problem.

But I think you should change the code in the examples, to reflect the current API

Thomas

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