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

Return &str from BasicAuth::user_id() and BasicAuth::password() #249

Merged
merged 2 commits into from
Jul 19, 2022

Conversation

mcronce
Copy link
Contributor

@mcronce mcronce commented May 24, 2022

PR Type

Feature/improvement

PR Checklist

  • Tests for the changes have been added / updated.
  • Documentation comments have been added / updated.
  • A changelog entry has been made for the appropriate packages.
  • Format code with the nightly rustfmt (cargo +nightly fmt).

Overview

Makes the two mentioned functions more easily usable in calling code

I would probably consider this a breaking change - the return types of public functions have changed. It might be the case that any code that compiled/worked previously will still compile, but I'm not super confident about that.

Fixes #238

…w<str> from BasicAuth::user_id() and BasicAuth::password()
@robjtede robjtede requested a review from a team May 24, 2022 14:10
@JohnTitor
Copy link
Member

Does it make sense to apply the same change to Bearer::token?

/// Gets reference to the credentials token.
pub fn token(&self) -> &Cow<'static, str> {
&self.token
}

@robjtede robjtede changed the title actix-web-httpauth: Return &str instead of Cow<str> from BasicAuth::user_id() and BasicAuth::password() eturn &str instead of Cow<str> from BasicAuth::user_id() and BasicAuth::password() May 24, 2022
@robjtede robjtede changed the title eturn &str instead of Cow<str> from BasicAuth::user_id() and BasicAuth::password() Return &str instead of Cow<str> from BasicAuth::user_id() and BasicAuth::password() May 24, 2022
@robjtede robjtede added A-httpauth Project: actix-web-httpauth B-semver-major breaking change requiring a major version bump labels May 24, 2022
Copy link
Member

@robjtede robjtede left a comment

Choose a reason for hiding this comment

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

yeah, i like it

@robjtede robjtede changed the title Return &str instead of Cow<str> from BasicAuth::user_id() and BasicAuth::password() Return &str from BasicAuth::user_id() and BasicAuth::password() Jul 19, 2022
@robjtede robjtede enabled auto-merge (squash) July 19, 2022 01:28
@robjtede robjtede merged commit 140453c into actix:master Jul 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-httpauth Project: actix-web-httpauth B-semver-major breaking change requiring a major version bump
Projects
None yet
Development

Successfully merging this pull request may close these issues.

actix-web-httpauth: Basic::{user_id,password} return reference to Cow
3 participants