module Grip::Extensions::Context

Direct including types

Defined in:

grip/extensions/context.cr

Instance Method Summary

Instance Method Detail

def binary(content, content_type = "application/octet-stream") #

Sends a response with no formating.


[View source]
def delete_req_header(key) #

Deletes request header.


[View source]
def delete_resp_header(key) #

Deletes response header.


[View source]
def exception : Exception | Nil #

[View source]
def exception=(exception : Exception | Nil) #

[View source]
def exec(&) #

[View source]
def fetch_body_params #

Fetches the parsed URL encoded parameters from an endpoint.


[View source]
def fetch_file_params #

Fetches the parsed multipart data from an endpoint.


[View source]
def fetch_json_params #

Fetches the parsed JSON content from an endpoint.


[View source]
def fetch_path_params #

Fetches the parsed URL data from an endpoint.


[View source]
def fetch_query_params #

Fetches the parsed GET query parameters from an endpoint.


[View source]
def get_req_cookie(key) #

Get cookie from request or nil if key does not exist


[View source]
def get_req_header(key) #

Gets request header, raises if not found.


[View source]
def get_req_header?(key) #

Gets request header, returns nil if not found.


[View source]
def get_resp_header(key) #

Gets response header.


[View source]
def halt #

Halts the execution of the endpoint


[View source]
def html(content, content_type = "text/html; charset=UTF-8") #

Sends a response with the content formated as html.


[View source]
def json(content, content_type = "application/json; charset=UTF-8") #

Sends a response with the content formated as json.


[View source]
def merge_resp_headers(headers) #

Merges the response headers with another hashmap


[View source]
def parameters : Grip::Parsers::ParameterBox | Nil #

[View source]
def parameters=(parameters : Grip::Parsers::ParameterBox | Nil) #

[View source]
def put_req_header(key, value) #

Assigns request header in the headers hashmap.


[View source]
def put_resp_cookie(key, val) #

Sets response cookie from string


[View source]
def put_resp_cookie(cookie) #

Sets response cookie


[View source]
def put_resp_header(key, value) #

Assigns response header in the headers hashmap.


[View source]
def put_status(status_code = HTTP::Status::OK) #

Assigns response status code.


[View source]
def redirect(url = "/", status_code = HTTP::Status::FOUND) #

[View source]
def send_file(path : String, mime_type : String | Nil = nil, gzip_enabled : Bool = false) #

Sends a file


[View source]
def send_resp(content) #

Sends a response with a status code of OK.


[View source]
def text(content, content_type = "text/plain; charset=UTF-8") #

Sends a response with the content formated as text.


[View source]