sintaxi / dbox

NodeJS SDK for Dropbox API (THIS LIBRARY IS OBSOLETE!!)
514 stars 91 forks source link

Global `options` variable is modified by `args` and can't be undone #27

Closed jpallen closed 11 years ago

jpallen commented 12 years ago

Is there a good reason for appending the args into the global options variable? This means that if I pass an argument like { parent_rev : 'foo' } to a put request it gets injected into options variable. It is then always sent on subsequent requests, and this throws an error from the API since calls like get don't understand parent_rev.

If this is an accident rather than by design then I will put together a patch that stops this happening and makes each args local to its own request.

Regards, James

sintaxi commented 12 years ago

Indeed this is a bug. Thanks for reporting it. A patch would be welcomed.

jpallen commented 12 years ago

Ok, I'll have a look into it further. I don't think there needs to be a global options variable at all. As far as I can tell the Dropbox API has no options which can be used on all API calls. So I think this should be done away with completely. Do you agree?

plediii commented 12 years ago

I was bitten by this issue as well. For instance if I send a cursor to client.delta, then every API request gets cursor as a parameter and dropbox replies with errors.