Created
August 14, 2019 19:55
-
-
Save charlesdrews/87d0d321e55599df28f36d9eaf92f317 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Retrieve the "next" url from the Link header of the API's response | |
* @param linkHeaderValue | |
*/ | |
private getNextUrlFromLinkHeader(linkHeaderValue: string): string { | |
const links = linkHeaderValue.split(","); | |
for (const link of links) { | |
if (link.indexOf("rel=\"next\"") > -1) { | |
const url = link.split("; ")[0]; | |
return url.replace(/[<>]/g, ""); | |
} | |
} | |
return ""; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment