feat(analyzer): detect HTTP QUERY routes in axum - #2580
Merged
Conversation
- 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
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.
Summary
Closes #2551.
Support HTTP
QUERYmethod routing in axum (building on tokio-rs/axum#3801 andhttpcrate v1.5.0):querytoHTTP_VERBSandBUILDER_ROUTE_EMIT_NAMESinAnalyzer::Rust::Axumto recognizerouting::query(handler), chainedMethodRouter.query(handler),query_service(svc), and route builder methods.MethodFilter::QUERYand method filter combinations (.or(...),|,MethodFilter::all()) inrouting::on,routing::on_service, and chained.on(...).Router::nest,merge) correctly propagates to allQUERYendpoints.spec/models/analyzer.crto require./code_locatorso analyzers can be loaded and tested standalone.Test plan
spec/unit_test/analyzer/analyzer_axum_spec.cr— 11 unit tests coveringquery(handler), chainedget(...).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.rsandspec/functional_test/testers/rust/axum_spec.cr— updated fixture and assertions withquery, chained.query(),query_service,on(MethodFilter::QUERY),on(MethodFilter::GET.or(MethodFilter::QUERY)), and nestedqueryroute.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.