params do
build_with Grape::Extensions::Hash::ParamBuilder
requires :avatar, type: File
end
post '/' do
...
end
Returns an error #<Grape::Exceptions::ValidationErrors: avatar is invalid> because:
- This line calls
deep_dup of hash values ( including tempfile)
|
rack_params.deep_dup.tap do |params| |
Tempfile#deep_dup returns instance of File
|
value.is_a?(::Hash) && value.key?(:tempfile) && value[:tempfile].is_a?(Tempfile) |
Returns an error
#<Grape::Exceptions::ValidationErrors: avatar is invalid>because:deep_dupof hash values ( including tempfile)grape/lib/grape/extensions/hash.rb
Line 14 in 0f57e01
Tempfile#deep_dupreturns instance ofFilegrape/lib/grape/validations/types/file.rb
Line 25 in 0f57e01