Closed
Conversation
…l Challenge for &str
Contributor
Author
|
I don't know how useful the test really is, but it allowed me to check the box ;) |
JohnTitor
reviewed
May 24, 2022
actix-web-httpauth/CHANGES.md
Outdated
| # Changes | ||
|
|
||
| ## Unreleased - 2021-xx-xx | ||
| - impl Challenge for &str |
Member
There was a problem hiding this comment.
Suggested change
| - impl Challenge for &str | |
| - impl `Challenge` for `&str` |
| use super::*; | ||
|
|
||
| #[proptest] | ||
| fn roundtrip_static_str(input: Box<str>) { |
Member
There was a problem hiding this comment.
I'm not sure if that conversion really needs to use such expensive testing, isn't it enough to add a basic test? We should be cautious to add an additional test framework just for one test.
ibraheemdev
reviewed
May 24, 2022
| #[proptest] | ||
| fn roundtrip_static_str(input: Box<str>) { | ||
| // This will leak, but it's probably fine in the context of a test. Fixable by adding: | ||
| // unsafe { Box::from_raw(s as *const str as *mut str); } |
Member
There was a problem hiding this comment.
Unleaking is UB, especially through a shared reference. This should use Box::into_raw and Box::from_raw if memory is to be cleaned up.
Member
|
( |
impl Challenge for &'static str
Member
|
Closing as inactivity, thanks for the PR anyway! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Type
Feature
PR Checklist
cargo +nightly fmt).Overview
As it stands, using
actix-web-httpauth::middleware::HttpAuthenticationrequires creating a type that implsChallengein order to return anAuthenticationError. This makes it possible to simply (e.g.)return Err(AuthenticationError::new("Authentication required").into())from your auth check function.