Skip to content

Incorrect generate Links for Headers #118

@kvandake

Description

@kvandake

When I configure custom parameters for library I get incorrect links for headers.

For example,

ApiPagination.configure do |config|

   ...

  # If you have more than one gem included, you can choose a paginator.
  config.paginator = :pagy # or :will_paginate

  # Optional: what parameter should be used to set the page option
  config.page_param do |params|
    params[:page][:number] if params[:page].is_a?(ActionController::Parameters)
  end

  # Optional: what parameter should be used to set the per page option
  config.per_page_param do |params|
    params[:page][:size] if params[:page].is_a?(ActionController::Parameters)
  end

   ...

end

Some response,

Link →<http://localhost:3000/api/reviews?page=1>; rel="first", <http://localhost:3000/api/reviews?page=2>; rel="prev", <http://localhost:3000/api/reviews?page=5>; rel="last", <http://localhost:3000/api/reviews?page=4>; rel="next"
X-Per-Page →20
X-Page →3
X-Total →86

Maybe is it hardcode?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions