mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-05-24 00:52:23 -04:00
17 lines
615 B
C#
17 lines
615 B
C#
using System.Text.Json;
|
|
using API.Helpers;
|
|
using Microsoft.AspNetCore.Http;
|
|
|
|
namespace API.Extensions
|
|
{
|
|
public static class HttpExtensions
|
|
{
|
|
public static void AddPaginationHeader(this HttpResponse response, int currentPage,
|
|
int itemsPerPage, int totalItems, int totalPages)
|
|
{
|
|
var paginationHeader = new PaginationHeader(currentPage, itemsPerPage, totalItems, totalPages);
|
|
response.Headers.Add("Pagination", JsonSerializer.Serialize(paginationHeader));
|
|
response.Headers.Add("Access-Control-Expose-Headers", "Pagination");
|
|
}
|
|
}
|
|
} |