feat(http_extensions): Add extension methods for http::Extensions#356
feat(http_extensions): Add extension methods for http::Extensions#356
Conversation
|
@microsoft-github-policy-service agree company="Microsoft" |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #356 +/- ##
=======================================
Coverage 100.0% 100.0%
=======================================
Files 221 222 +1
Lines 15995 16001 +6
=======================================
+ Hits 15995 16001 +6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@Everod52 Hi there, to fix the static analysis issue, you need to update the readme files so they match the current module docs. You can do this using 'just readmes'. |
…ons-ext # Conflicts: # crates/http_extensions/README.md
There was a problem hiding this comment.
Pull request overview
Adds a new extension trait to centralize URL template label extraction on http::Extensions, and wires existing request helpers to use it for consistent behavior across request/extension call sites.
Changes:
- Introduce
ExtensionsExt::url_template_label()forhttp::Extensions, including unit tests. - Refactor
RequestExt::url_template_label()to delegate toExtensionsExt. - Update crate docs and README to document/export the new extension trait.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/http_extensions/src/lib.rs | Documents and re-exports the new ExtensionsExt trait from the crate root. |
| crates/http_extensions/src/extensions/request_ext.rs | Simplifies request label extraction by delegating to ExtensionsExt. |
| crates/http_extensions/src/extensions/mod.rs | Registers and re-exports the new extensions_ext module/trait. |
| crates/http_extensions/src/extensions/extensions_ext.rs | Adds ExtensionsExt implementation + tests for extracting UrlTemplateLabel from http::Extensions. |
| crates/http_extensions/README.md | Updates the generated README to include ExtensionsExt and refresh link references. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ons-ext # Conflicts: # crates/http_extensions/README.md
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| #[test] | ||
| fn returns_label_from_target_path_and_query() { | ||
| let mut extensions = Extensions::new(); | ||
| extensions.insert(TargetPathAndQuery::from_path_and_query("/path".parse().unwrap())); | ||
|
|
||
| assert_eq!( | ||
| extensions.url_template_label().as_ref().map(UrlTemplateLabel::as_str), | ||
| Some("/path") | ||
| ); | ||
| } |
There was a problem hiding this comment.
The test name returns_label_from_target_path_and_query is misleading: TargetPathAndQuery::from_path_and_query(...) appears to produce a plain path where label() is typically None and the code falls back to template(). Consider renaming the test to reflect that it’s validating the template fallback, or construct a TargetPathAndQuery with an explicit label so the test actually exercises the label branch.
No description provided.