feat(resources-introspection): add support for resource metadata retrieval #3594
+405
−8
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
Overview
Hello, this is my first contribution to the project. This PR introduces a new resource introspection feature for actix‑web that allows retrieving all configured route paths along with their associated HTTP methods after the server has started. It does not support all
Guards
, only the basic ones that determine HTTP methods.The feature is activated using the
resources-introspection
feature flag.The main method is
actix_web::introspection::get_registered_resources()
, which returns a vector ofResourceIntrospection
objects. This method can be executed in an async task alongside the actix‑web server or on a separate thread.I developed this feature because it’s extremely useful for auditing services with many route paths that change constantly. I hope it proves valuable for others as well, and I welcome any feedback or suggestions for improvement.
#1462 #2677