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

Handle blank password in basic auth. #690

Merged
merged 2 commits into from
Oct 24, 2013

Conversation

diversario
Copy link
Contributor

Fixes #681.

@nylen
Copy link
Member

nylen commented Oct 24, 2013

My only issue with this is that now options.auth.pass will behave differently from options.auth.password. However, there's already a similar issue with options.auth.user vs options.auth.username, so I'm not sure how much this matters. @mikeal, care to comment?

@diversario
Copy link
Contributor Author

@nylen that's true. Are password and username legacy options? If so it would make sense to map them on the shorter fields, if they're present. I can't imagine that people use both at the same time. So, something like

if (Object.prototype.hasOwnProperty.call(options.auth, 'username')) options.auth.user = options.auth.username
if (Object.prototype.hasOwnProperty.call(options.auth, 'password')) options.auth.pass = options.auth.password

No need to care about legacy options after this.

@nylen
Copy link
Member

nylen commented Oct 24, 2013

I agree. Personally I would have gone with typeof options.auth.username != 'undefined', but I'd merge it either way.

I put the alias names in there so that you could use either variant, without having to refer back to the docs to remember the naming convention.

@diversario
Copy link
Contributor Author

How about that? Last commit?

mikeal added a commit that referenced this pull request Oct 24, 2013
@mikeal mikeal merged commit 7fd5498 into request:master Oct 24, 2013
@nylen
Copy link
Member

nylen commented Oct 24, 2013

Much cleaner, thanks!

@mikeal
Copy link
Member

mikeal commented Oct 24, 2013

for some reason Travis is complaining about tests failing with optionals enabled/disbled or something. i have no idea what that means.

@diversario
Copy link
Contributor Author

Tests pass locally (for me, at least).

@mikeal
Copy link
Member

mikeal commented Oct 24, 2013

me too :)

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

Successfully merging this pull request may close these issues.

Blank passwords result in different Auth headers
3 participants