class Athena::Routing::RequestContext

Overview

Represents data from a request in an agnostic manner, primarily used to augment URL matching and generation with additional context.

Defined in:

request_context.cr

Constructors

Instance Method Summary

Constructor Detail

def self.from_uri(uri : String, host : String = "localhost", scheme : String = "http", http_port : Int32 = 80, https_port : Int32 = 443) : self #

Creates a new instance of self from the provided uri. The host, scheme, http_port, and https_port optionally act as fallbacks if they are not contained within the uri.


[View source]
def self.from_uri(uri : URI, host : String = "localhost", scheme : String = "http", http_port : Int32 = 80, https_port : Int32 = 443) : self #

Creates a new instance of self from the provided uri. The host, scheme, http_port, and https_port optionally act as fallbacks if they are not contained within the uri.


[View source]
def self.new(base_url : String = "", method : String = "GET", host : String = "localhost", scheme : String = "http", http_port : Int32 = 80, https_port : Int32 = 443, path : String = "/", query_string : String = "") #

[View source]

Instance Method Detail

def apply(request : ART::Request) : self #

Updates the properties within self based on the provided request.


[View source]
def base_url : String #

Represents the path of the URL before #path. E.g. a path that should be prefixed to all other #paths.


[View source]
def base_url=(base_url : String) : self #

[View source]
def has_parameter?(name : String) : Bool #

[View source]
def host : String #

[View source]
def host=(host : String) : self #

[View source]
def http_port : Int32 #

[View source]
def https_port : Int32 #

[View source]
def method : String #

[View source]
def method=(method : String) : self #

[View source]
def parameters : Hash(String, String | Nil) #

Returns the global parameters that should be used as part of the URL generation logic.


[View source]
def path : String #

[View source]
def path=(path : String) : self #

[View source]
def query_string : String #

Returns the query string of the current request.


[View source]
def query_string=(query_string : String | Nil) : self #

[View source]
def scheme : String #

[View source]
def scheme=(scheme : String) : self #

[View source]
def set_parameter(name : String, value : String | Nil) : self #

[View source]