Replace ExtractAuthority with CanOverrideAuthority#481
Merged
zaharidichev merged 1 commit intover/transparent-override-absolutefrom Apr 20, 2020
Merged
Replace ExtractAuthority with CanOverrideAuthority#481zaharidichev merged 1 commit intover/transparent-override-absolutefrom
zaharidichev merged 1 commit intover/transparent-override-absolutefrom
Conversation
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.
zaharidichev
pushed a commit
that referenced
this pull request
Apr 20, 2020
* Remove the IntoAbsForm trait 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 * Replace ExtractAuthority with CanOverrideAuthority (#481) 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.
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 thenaming in the controller/API.
I've also moved
layer => Layer::new, which is the newer idiom we'retargetting.