class

Analyzer::Dart::Http

Inherits Analyzer < FileHelper < Reference < Object

dart:io's HttpServer is Dart's built-in HTTP server surface. It has no declarative router, so routes are usually guards over HttpRequest.method and HttpRequest.uri.path inside an await for or listen handler.

Constants

BODY_READ_RE = /utf8\s*\.\s*decoder\s*\.\s*bind\s*\([^\)]*\)|\.transform\s*\(\s*utf8\s*\.\s*decoder\s*\)|jsonDecode\s*\(/
COOKIE_NAME_RE = /\.cookies\b.*?\.name\s*==\s*r?["']([^"']+?)["']/
DART_IO_IMPORT_RE = /^\s*import\s+['"]dart:io['"]/m
HEADER_INDEX_RE = /\.headers\s*\[\s*r?["']([^"']+?)["']\s*\]/
HEADER_VALUE_RE = /\.headers\s*\.\s*value\s*\(\s*r?["']([^"']+?)["']/
HTTP_METHODS = "GET|POST|PUT|PATCH|DELETE|HEAD|OPTIONS|TRACE"
HTTP_SURFACE_RE = Regex.union("HttpServer", "HttpRequest")

Whole-file detection gate, evaluated once per .dart file. A precompiled Regex.union (PCRE2 JIT) replaces the two OR-ed String#includes? scans it used to run — provably equivalent since union auto-escapes each literal.

METHOD_CASE_RE = /(?:^|[^\w.])case\s+r?["'](#{HTTP_METHODS})["']\s*:/
METHOD_COMPARE_RE = /\b([A-Za-z_]\w*)\s*\.\s*method\s*==\s*r?["'](#{HTTP_METHODS})["']/
PATH_CASE_RE = /(?:^|[^\w.])case\s+r?["']([^"']+?)["']\s*:/
PATH_COMPARE_RE = /\b([A-Za-z_]\w*)\s*\.\s*uri\s*\.\s*path\s*==\s*r?["']([^"']+?)["']/
PATH_STARTS_WITH_RE = /\b([A-Za-z_]\w*)\s*\.\s*uri\s*\.\s*path\s*\.\s*startsWith\s*\(\s*r?["']([^"']+?)["']/
QUERY_PARAM_RE = /\.uri\s*\.\s*queryParameters(?:All)?\s*\[\s*r?["']([^"']+?)["']\s*\]/
REVERSE_METHOD_RE = /r?["'](#{HTTP_METHODS})["']\s*==\s*\b([A-Za-z_]\w*)\s*\.\s*method/
REVERSE_PATH_RE = /r?["']([^"']+?)["']\s*==\s*\b([A-Za-z_]\w*)\s*\.\s*uri\s*\.\s*path/
SWITCH_METHOD_RE = /\bswitch\s*\([^\)]*\.\s*method\s*\)/
SWITCH_PATH_RE = /\bswitch\s*\([^\)]*\.\s*uri\s*\.\s*path\s*\)/

Class methods

tech_name
Source

Instance methods

analyze
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

Nested types