Is there any way that I can common header in Rails with Grape so I do not have to specify the same header over and over again?
namespace :user do
desc 'Return a user.', {
headers: {
"Authorization" => {
description: "Some Token",
required: true
}
}
}
get do
{}
end
end
Notice that headers would have to be specified over and over in all my APIs since I want them to be secure. Is there a shortcut way (a design pattern) that I can follow without creating this header everytime?
And no I am not looking for something like this:
def headers { "Authorization" => { description: "Some Token", required: true } } end
namespace :user do desc 'Return a user.', { headers: headers } get do {} end end
Aucun commentaire:
Enregistrer un commentaire