/
data.cr
32 lines (26 loc) · 959 Bytes
/
data.cr
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
require "./concerns/*"
module Marten
module HTTP
module Params
# Represents the parsed content of a request's body, including both non-file and file inputs.
class Data
# :nodoc:
alias Value = JSON::Any | String | UploadedFile
# :nodoc:
alias Values = Array(Value)
# :nodoc:
alias RawHash = Hash(String, Array(String) | Array(JSON::Any) | Array(UploadedFile) | Values)
include Enumerable({String, Array(String) | Array(JSON::Any) | Array(UploadedFile) | Values})
include Core
def initialize
@params = RawHash.new
end
def initialize(@params : RawHash)
if !Marten.settings.request_max_parameters.nil? && size > Marten.settings.request_max_parameters.as(Int32)
raise Errors::TooManyParametersReceived.new("The number of parameters that were received is too large")
end
end
end
end
end
end