Remove the IntoAbsForm trait#480
Merged
zaharidichev merged 2 commits intozd/use-auth-overridefrom Apr 20, 2020
Merged
Conversation
This change modifies the `HasSettings` trait to return a `Settings` (rather than a reference). The `Settings` type is a simple type with a few bools, so it's safe to copy freely. This enables us to implement `HasSettings` for `http::HttpEndpoint` by overriding the `was_absolute_from` when appropriate without having to introduce an additional trait
Contributor
|
Looks like this might've broken something? |
Member
Author
|
@hawkw afaict that test may be flakey (passes locally) |
zaharidichev
approved these changes
Apr 20, 2020
Member
zaharidichev
left a comment
There was a problem hiding this comment.
I see how this is better and removed the unnecessary indirection. Thanks!
The extractor pattern is useful when we need to use additional configuration or when we don't control the type over which we're extracting a value (like an http::Request). But in the case of authority overrides, we have all of the information we need on the target type. This change replaces the ExtractAuthority strategy with a CanOverrideAuthority trait that must be implemented by targets. I've also modified logging to be at the debug level (request modification seems useful to observe when debugging), and I've renamed some variables to match the tracing output. I think, as a follow up, I'd prefer that we call this module `override_authority` (rather than "overwrite"), as this matches the naming in the controller/API. I've also moved `layer => Layer::new`, which is the newer idiom we're targetting.
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.
@zaharidichev What do you think of this?
This change modifies the
HasSettingstrait to return aSettings(rather than a reference). The
Settingstype is a simple type with afew bools, so it's safe to copy freely.
This enables us to implement
HasSettingsforhttp::HttpEndpointbyoverriding the
was_absolute_fromwhen appropriate without having tointroduce an additional trait