fix(Shopify Node): Fix pagination when using options (#6972)

This commit is contained in:
Jon 2023-08-21 10:47:38 +01:00 committed by GitHub
parent dd233bdf7d
commit 475d9c98e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -64,6 +64,20 @@ export async function shopifyApiRequest(
delete options.qs;
}
// Only limit and fields are allowed for page_info links
// https://shopify.dev/docs/api/usage/pagination-rest#limitations-and-considerations
if (uri && uri.includes('page_info')) {
options.qs = {};
if (query.limit) {
options.qs.limit = query.limit;
}
if (query.fields) {
options.qs.fields = query.fields;
}
}
return this.helpers.requestWithAuthentication.call(this, credentialType, options, {
oauth2: oAuth2Options,
});