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

Simplify jar overloading by permitting string inputs #376

Merged
merged 3 commits into from
Jul 17, 2021

Conversation

alanbixby
Copy link
Member

@alanbixby alanbixby commented Jun 30, 2021

To overload jar, you need to pass an object { session: 'COOKIE' }, this is not intuitive and results in over complicated looking code.

await noblox.getCurrentUser({ jar: { session: 'COOKIE' } })
// is now equivalent to
await noblox.getCurrentUser({ jar: 'COOKIE' })

This pull request removes the need for the session object, enabling a cookie string to be passed instead of the wrapper object- backwards compatibility is maintained.


string and object (str) highlight the new functionality

image
image

@alanbixby
Copy link
Member Author

When making the test case screenshots I also noticed getCurrentUser() is case-sensitive, so I slapped a quick filter in to patch that too.

await noblox.getCurrentUser()
await noblox.getCurrentUser('UserName')
await noblox.getCurrentUser('uSeRNaME') // <- used to return undefined

OLD:
image
NEW:
image

@Neztore Neztore added the enhancement New feature or request label Jun 30, 2021
Copy link
Member

@Neztore Neztore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I initially had reservations as this would not play well with setting session_only to false.
As it turns out, setting session_only to false is broken in the current version of the library anyway - is it worth supporting going forward? I think this change is fine and simplifies authentication in a way which is closer to what we want

@Neztore Neztore merged commit 927ab75 into noblox:master Jul 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants