### CONTEXT: basic '/' route - [x] returns 201 as a status - [x] returns the complete body as string - [x] sets a header as foo - [x] /hello routes gets hello route ### CONTEXT: returning an IO-like object - [x] returns 200 as Status - [x] returns the object's body ### CONTEXT: body responses - [x] returns empty array when body is nil ### CONTEXT: missing routes - [x] 404s and sets X-Cascade header when no route satisfies the request - [x] 404s and does not set X-Cascade header when no route satisfies the request and x_cascade has been disabled ### CONTEXT: 404 - [x] recalculates body length correctly for 404 response ### CONTEXT: unicode - [x] allows using unicode - [x] it handles encoded slashes correctly - [x] overrides the content-type in error handlers ### CONTEXT: PATH_INFO - [x] matches empty PATH_INFO to "/" if no route is defined for "" - [x] matches empty PATH_INFO to "" if a route is defined for "" ### CONTEXT: takes multiple definitions of a route - [x] takes multiple definitions of a route ### CONTEXT: params - [x] supports named params like /hello/:person - [x] exposes params with indifferent hash - [x] merges named params and query string params in params - [x] supports optional named params like /?:foo?/?:bar? - [x] exposes nested params with indifferent hash - [x] exposes params nested within arrays with indifferent hash - [x] supports arrays within params - [x] supports deeply nested params - [x] preserves non-nested params ### CONTEXT: route flow - [x] returns response immediately on halt - [x] halts with a response tuple - [x] halts with an array of strings - [x] sets response.status with halt - [x] transitions to the next matching route on pass - [x] transitions to 404 when passed and no subsequent route matches - [x] transitions to 404 and sets X-Cascade header when passed and no subsequent route matches - [x] uses optional block passed to pass as route block if no other route is found - [x] matches routes defined in superclasses - [x] matches routes in subclasses before superclasses - [x] allows using call to fire another request internally - [x] plays well with other routing middleware ### CONTEXT: conditions - [x] passes to next route when condition calls pass explicitly - [x] passes when matching condition returns false - [x] does not pass when matching condition returns nil - [x] allows custom route-conditions to be set via route options ### CONTEXT: host condition - [x] passes to the next route when host_name does not match ### CONTEXT: agent condition - [x] passes to the next route when user_agent does not match - [x] treats missing user agent like an empty string - [x] makes captures in user agent pattern available in params[:agent] - [x] adds hostname condition when it is in options ### Context: provides condition - [x] matches mime_types with dots, hyphens and plus signs - [x] filters by accept header - [x] filters by current Content-Type - [x] allows multiple mime types for accept header - [x] respects user agent preferences for the content type - [x] accepts generic types - [x] prefers concrete over partly generic types - [x] prefers concrete over fully generic types - [x] prefers partly generic over fully generic types - [x] respects quality with generic types - [x] supplies a default quality of 1.0 - [x] orders types with equal quality by parameter count - [x] ignores the quality parameter when ordering by parameter count - [x] properly handles quoted strings in parameters - [x] accepts both text/javascript and application/javascript for js - [x] accepts both text/xml and application/xml for xml ### CONTEXT: pattern matching - [x] supports named captures like %r{/hello/(?<person>[^/?#]+)} - [x] supports optional named captures like %r{/page(?<format>.[^/?#]+)?} - [x] does not concatenate params with the same name - [x] supports single splat params like /* - [x] supports mixing multiple splat params like /_/foo/_/* - [x] supports mixing named and splat params like /:foo/* - [x] supports basic nested params - [x] URL decodes named parameters and splats - [x] supports regular expressions - [x] makes regular expression captures available in params[:captures] - [x] supports regular expression look-alike routes - [x] raises a TypeError when pattern is not a String or Regexp ### CONTEXT: route invocation - [x] passes a single url param as block parameters when one param is specified - [x] passes multiple params as block parameters when many are specified - [x] passes regular expression captures as block parameters - [x] supports mixing multiple splat params like /_/foo/_/\* as block parameters - [x] raises an ArgumentError with block arity > 1 and too many values - [x] raises an ArgumentError with block param arity > 1 and too few values - [x] succeeds if no block parameters are specified - [x] passes all params with block param arity -1 (splat args) - [x] raises an ArgumentError with block param arity 1 and no values - [x] raises an ArgumentError with block param arity 1 and too many values ### CONTEXT: special characters - [x] matches a dot ('.') as part of a named param - [x] matches a literal dot ('.') outside of named param - [x] literally matches dot in paths - [x] literally matches dollar sign in paths - [x] literally matches plus sign in paths - [x] does not convert plus sign into space as the value of a named param - [x] literally matches parens in paths - [x] matches paths that include spaces encoded with %20 - [x] matches paths that include spaces encoded with + - [x] matches paths that include ampersands ### CONTEXT: route internals - [x] returns the route signature (no longer a requirement) - [x] sets env['sinatra.route'] to the matched route
CONTEXT: basic '/' route
CONTEXT: returning an IO-like object
CONTEXT: body responses
CONTEXT: missing routes
CONTEXT: 404
CONTEXT: unicode
CONTEXT: PATH_INFO
CONTEXT: takes multiple definitions of a route
CONTEXT: params
CONTEXT: route flow
CONTEXT: conditions
CONTEXT: host condition
CONTEXT: agent condition
Context: provides condition
CONTEXT: pattern matching
CONTEXT: route invocation
CONTEXT: special characters
CONTEXT: route internals