Merge pull request #281 from spurdy/patch-1

fix(RequestHelper): Prevent mangled URL when redirected to https
This commit is contained in:
jdalrymple 2019-03-07 12:25:28 -05:00 committed by Justin
commit dcc9d9d391

View File

@ -103,6 +103,10 @@ async function getPaginated(
// If not looking for a singular page and still under the max pages limit
// AND their is a next page, paginate
if (!queryOptions.page && underMaxPageLimit && links.next) {
// If redirected from http:// to https://, need to update service.url to avoid url inception
if (service.url.slice(0, 5) === 'http:' && links.next.url.slice(0, 5) === 'https') {
service.url = service.url.replace('http:', 'https:');
}
more = await getPaginated(service, links.next.url.replace(service.url, ''), options);
data = [...response.body, ...more];
} else {