我有一个命名空间模型是这样的: class Message::Notification < Message
end
我定义一个实体是这样的: class Message::Notification < Grape::Entity
expose :id
end
有一个错误,当目前的模式: present @notification, with: Entities::Messag
自定义标题PARAMS我用葡萄API和我需要编写自定义页眉测试 我的代码: it "should accept message" do
post "/api/v1/my/route", post_data, secret: "ASDFGHJKL"
last_response.status.should == 201
end
但路线得不到头可言, 我也试过heade
当定义使用葡萄的API,有验证的存在和参数类型,例如一个非常方便的方法: params do
requires :param1, type: String
optional :param1, type: Integer
end
但是我没有看到指定两个参数互斥的简便方法。 EG它会是这样的: params do
requires :creatureName, ty
如果我在Grape API请求上设置参数验证,是否可以获得验证参数的哈希值? desc "My Grape API request handler"
params do
requires :name
optional :description
end
post do
puts params.inspect # has all the params passed