class

Analyzer::Crystal::Http

Inherits Analyzer::Crystal::CrystalEngine < FileScanEngine < Analyzer < FileHelper < Reference < Object

Constants

METHOD_THEN_PATH_RE = /context\.request\.method\s*(?:==|===)\s*["'](GET|POST|PUT|DELETE|PATCH|HEAD|OPTIONS)["']\s*&&\s*.*context\.request\.path\s*(?:==|===)\s*["']([^"']+?)["']/

Precompiled regexes (avoid repeated compilation of interpolated literals inside the per-line hot path; mirrors the VERB_ROUTE_PATTERNS approach in grip.cr).

PATH_COMPARE_RE = /context\.request\.path\s*(?:==|===|\.starts_with\?|\.includes\?)\s*\(?\s*["']([^"']+?)["']/
PATH_THEN_METHOD_RE = /context\.request\.path\s*(?:==|===)\s*["']([^"']+?)["']\s*&&\s*.*context\.request\.method\s*(?:==|===)\s*["'](GET|POST|PUT|DELETE|PATCH|HEAD|OPTIONS)["']/
WHEN_RE = /(?:^|[^.\w])when\s+["']([^"']+?)["']/

Class methods

tech_name
Source

Instance methods

analyze_file(path : String) : Array(Endpoint)
Source
line_to_endpoint(content : String, in_path_case : Bool = false) : Endpoint

in_path_case is only used to gate the unconditional when matcher. The explicit method && path and path == checks are safe to run unconditionally (they mention the request objects) and are therefore handled the same way inside/outside.

Source
line_to_param(content : String) : Param
Source
tech

Instance-side view of the same declaration. The per-file rescues live on this base class, which has no way to name the analyzer that is running inside them, so a skipped file could not be attributed to a tech. Deriving it from analyzer_for keeps the name written exactly once.

Source