Skip to content

feat(analyzer): detect HTTP QUERY routes in axum - #2580

Merged
hahwul merged 1 commit into
mainfrom
hahwul/fix-issue-2551
Aug 15, 2026
Merged

feat(analyzer): detect HTTP QUERY routes in axum#2580
hahwul merged 1 commit into
mainfrom
hahwul/fix-issue-2551

Conversation

@hahwul

@hahwul hahwul commented Aug 15, 2026

Copy link
Copy Markdown
Member

Summary

Closes #2551.

Support HTTP QUERY method routing in axum (building on tokio-rs/axum#3801 and http crate v1.5.0):

  • Add query to HTTP_VERBS and BUILDER_ROUTE_EMIT_NAMES in Analyzer::Rust::Axum to recognize routing::query(handler), chained MethodRouter.query(handler), query_service(svc), and route builder methods.
  • Support MethodFilter::QUERY and method filter combinations (.or(...), |, MethodFilter::all()) in routing::on, routing::on_service, and chained .on(...).
  • Ensure nested router prefix composition (Router::nest, merge) correctly propagates to all QUERY endpoints.
  • Update spec/models/analyzer.cr to require ./code_locator so analyzers can be loaded and tested standalone.

Test plan

  • spec/unit_test/analyzer/analyzer_axum_spec.cr — 11 unit tests covering query(handler), chained get(...).query(...), query_service, on(MethodFilter::QUERY), MethodFilter::GET.or(MethodFilter::QUERY), MethodFilter::GET | MethodFilter::QUERY, MethodFilter::all(), chained .on(), custom route builders, prefix composition with nested routers, and #[cfg(test)] exclusion.
  • spec/functional_test/fixtures/rust/axum/src/main.rs and spec/functional_test/testers/rust/axum_spec.cr — updated fixture and assertions with query, chained .query(), query_service, on(MethodFilter::QUERY), on(MethodFilter::GET.or(MethodFilter::QUERY)), and nested query route.
  • just test — all 4,789 unit tests and 22,733 functional tests pass (0 failures, 0 errors).
  • crystal tool format --check — clean.
  • ameba — 2,140 files inspected, 0 failures.

- Support axum routing::query, routing::query_service, and MethodRouter::query
- Support MethodFilter::QUERY and combinations via .or() and bitwise |
- Ensure nested router prefix composition propagates to QUERY routes
- Update axum functional test and fixture with QUERY routes
- Add comprehensive unit tests for axum analyzer QUERY routing
@github-actions github-actions Bot added 🔬 analyzer Issue for Analyzer 💊 spec Issue for test codes labels Aug 15, 2026
@hahwul
hahwul merged commit f82c112 into main Aug 15, 2026
10 checks passed
@hahwul
hahwul deleted the hahwul/fix-issue-2551 branch August 15, 2026 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔬 analyzer Issue for Analyzer 💊 spec Issue for test codes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(analyzer): detect HTTP QUERY routes in axum

1 participant