我需要使用apipie-rails生成API,但是我想生成标题文档,例如“X-User-Email”或“X-User-Token”。
我有这个资源描述:
resource_description do
short 'Cars'
formats ['json']
param 'X-User-Email <X-User-Email>', String, :desc => "HEADER param: Email must correspond to TOKEN owner", :required => false
param 'X-User-Token <X-User-Token>', String, :desc => "HEADER param: Token must correspond to EMAIL owner", :required => false
error :code => 401, :desc => "Unauthorized - Returned when authentication can't be achieved via login or missing/expired api token"
end
但是,在这种情况下,论证param
对我没有帮助。
这可能吗?
答案 0 :(得分:1)
您可以执行以下操作:
header 'X-User-Email', '...expected value...'