-
Notifications
You must be signed in to change notification settings - Fork 54
Support setting access token per-instance in addition to accepting it as an arg to each method #145
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
Conversation
This is done because things will fail if a property has a value of undefined (like we are about to with the defaultAuth prop)
This should be exhaustive; any API method that includes an http auth parameter should pass it through to the agent
Co-authored-by: Matthew Mirande <busticated@users.noreply.github.com>
This fix makes api.getEventStream() honor a baseUrl that has been changed via api.setBaseUrl.
|
Thanks for the earlier review @busticated. Since then, while integrating this change into https://github.com/particle-iot/cli/pull/133 I discovered and a fixed a bug in 6408739 Also, I decided to fix this tiny bug Brett identified in 10cb93b as well. Once you've approved these two commits, I'll merge, cut a minor release, and finish validating everything is cool in the Delorean/cli-land PR with API auth usage without the proxy using latest particle-api-js release (i.e. return to https://github.com/particle-iot/cli/pull/133 ) |
busticated
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good @joegoggins - nice work 🙏 👍
Overview
Introduces the ability to set a default auth token on the Particle API instance so you don't have to specify it to each REST related method. Can pass it via
autharg to constructor OR via newsetDefaultAuth(auth)method on the instance.Increases minimum required test coverage to where we currently stand at 91% rather than 50%.
See sc-76665 for more details.
How to test?
Observe the changes to unit tests.
Also, you can end to end test the changes via:
-1:
git checkout sc-76665/setDefaultAuthandnpm i0. Run
npm run compilefooscript like this in the root of the repo.node foo