diff options
Diffstat (limited to 'app/controllers/api_controller.rb')
-rw-r--r-- | app/controllers/api_controller.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/app/controllers/api_controller.rb b/app/controllers/api_controller.rb index db4035a96..5243f7d7b 100644 --- a/app/controllers/api_controller.rb +++ b/app/controllers/api_controller.rb @@ -1,4 +1,7 @@ class ApiController < ApplicationController + DEFAULT_STATUSES_LIMIT = 20 + DEFAULT_ACCOUNTS_LIMIT = 40 + protect_from_forgery with: :null_session skip_before_action :verify_authenticity_token @@ -54,6 +57,13 @@ class ApiController < ApplicationController response.headers['Access-Control-Allow-Headers'] = 'Origin, X-Requested-With, Content-Type, Accept, Authorization' end + def set_pagination_headers(next_path = nil, prev_path = nil) + links = [] + links << [next_path, [['rel', 'next']]] if next_path + links << [prev_path, [['rel', 'prev']]] if prev_path + response.headers['Link'] = LinkHeader.new(links) + end + def current_resource_owner User.find(doorkeeper_token.resource_owner_id) if doorkeeper_token end |