class Runcobo::RequestInput

Overview

One cache per request, shared by body limits and both contract entry styles.

Defined in:

runcobo/request_input.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(request : HTTP::Request) #

[View source]

Instance Method Detail

def body(limit : Int64 = @max_body_size) : String #

Rewind the request body for consumers such as multipart parsers. Contracts use the cached string rather than reading the replacement stream again.


[View source]
def cleanup_uploads : Nil #

[View source]
def contract_input(limit : Int64 = @max_body_size) #

[View source]
def form(limit : Int64 = @max_body_size) : HTTP::Params #

[View source]
def json(limit : Int64 = @max_body_size, *, empty_object = false) : JSON::Any #

[View source]
def max_body_size : Int64 #

[View source]
def max_body_size=(max_body_size : Int64) #

[View source]
def merged(limit : Int64 = @max_body_size) : HTTP::Params | JSON::Any #

Request-level contracts combine query, body and route fields explicitly. Structured body fields replace query fields; route fields always win. Ordinary form values append, preserving duplicate-scalar validation.


[View source]
def multipart? : Bool #

[View source]
def query : HTTP::Params #

[View source]
def raw_body : String | Nil #

[View source]
def upload(name : String, limit : Int64 = @max_body_size) : UploadFile #

[View source]
def uploads(name : String, limit : Int64 = @max_body_size) : Array(UploadFile) #

[View source]