Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(resources-introspection): add support for resource metadata retrieval #3594

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

dertin
Copy link

@dertin dertin commented Mar 3, 2025

PR Type

Feature

PR Checklist

  • Tests for the changes have been added / updated.
  • Documentation comments have been added / updated.
  • A changelog entry has been made for the appropriate packages.
  • Format code with the latest stable rustfmt.
  • (Team) Label with affected crates and semver status.

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 of ResourceIntrospection 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant