Skip to content

Commit

Permalink
Ajout d'un header pour savoir s'il y a une page suivante
Browse files Browse the repository at this point in the history
Ce header permet de conditioner la présence d'un bouton pour voir la
page suivante des articles.
  • Loading branch information
Mopolo committed Jul 5, 2024
1 parent a81caf0 commit fa17b1e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public function __invoke(Request $request): Response
'Content-Type' => 'application/json',
'X-Pagination-Total' => $totalCount,
'X-Pagination-Per-Page' => $perPage,
'X-Pagination-Has-Next-Page' => $totalCount > $page * $perPage,
]
);
}
Expand Down
2 changes: 2 additions & 0 deletions tests/behat/features/Api/PlanetePHPApi.feature
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Feature: PlanetePHP API routes
And the response header "Content-Type" should equal "application/json"
And the response header "X-Pagination-Total" should equal 22
And the response header "X-Pagination-Per-Page" should equal 20
And the response header "X-Pagination-Has-Next-Page" should match '#^1$#'
And the json response has the key "title" with value "Un titre"
And the json response has the key "url" with value "https:\/\/afup.org\/url.html"
And the json response has the key "author" with value "Un super auteur"
Expand All @@ -17,6 +18,7 @@ Feature: PlanetePHP API routes
And the response header "Content-Type" should equal "application/json"
And the response header "X-Pagination-Total" should equal 22
And the response header "X-Pagination-Per-Page" should equal 20
And the response header "X-Pagination-Has-Next-Page" should match '#^$#'
And the json response has the key "title" with value "Un titre 18"
And the json response has the key "url" with value "https:\/\/afup.org\/url-18.html"
And the json response has the key "author" with value "Un super auteur 18"
Expand Down

0 comments on commit fa17b1e

Please sign in to comment.