Only get lowercased link header

Signed-off-by: Robert Bunning <rbunning@webstaurantstore.com>
This commit is contained in:
Robert Bunning
2023-08-04 11:46:19 -04:00
parent a6f2f70515
commit 96846456b1
2 changed files with 3 additions and 4 deletions
+2 -2
View File
@@ -135,7 +135,7 @@ describe('NewRelicClient', () => {
ok: true,
json: async () => ({ applications: [] }),
headers: new Map<string, string | null>([
['Link', '<https://next.page/page3?page=3>; rel="next",'],
['link', '<https://next.page/page3?page=3>; rel="next",'],
]),
})
.mockResolvedValueOnce({
@@ -178,7 +178,7 @@ describe('NewRelicClient', () => {
expect(actual).toStrictEqual(expected);
});
test.each([['LINK'], ['lINK']])(
test.each([['Link'], ['LINK'], ['lINK']])(
'It does not attempt pagination when the link header name is invalid (%p)',
async linkHeaderName => {
const mockedDiscoveryApi: DiscoveryApi = {
+1 -2
View File
@@ -142,8 +142,7 @@ export class NewRelicClient implements NewRelicApi {
}
const readResponse = responseJson as NewRelicApplications;
const linkHeader =
response.headers.get('Link') || response.headers.get('link');
const linkHeader = response.headers.get('link');
const pagination = this.parseLinkHeader(linkHeader);
return {