Only get lowercased link header
Signed-off-by: Robert Bunning <rbunning@webstaurantstore.com>
This commit is contained in:
@@ -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 = {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user