Mobafire LoL Builds

FREEMIUM
By Slimjim2448 | Updated a month ago | Gaming
Popularity

0.3 / 10

Latency

637ms

Service Level

0%

Health Check

N/A

Back to All Discussions

Result grows after each GET

Rapid account: Abrowncownow
abrowncownow
2 years ago

I was just testing this on a basic level. Each time I run the fetch request, my array grows. it started with <200 results and now Iโ€™m over 5000. It isnโ€™t a local problem, because when I change the variable, the result is the same (huge fetch return). How/Why am I getting a larger request each time. I would like the id-list data that I pull to remain the same .length
Here is my very simple code:

const options = {
    method: "GET",
    headers: {
        "X-RapidAPI-Key": "{myapikey}",
        "X-RapidAPI-Host": "mobafire-lol-builds.p.rapidapi.com",
    },
};

var ChampId = [];
function getChampList(){
    fetch(
        "https://mobafire-lol-builds.p.rapidapi.com/api/champions/id-list",
        options
    )
        .then((response) => response.json())
        .then(function (data) {            
            ChampId = data;
						 // Use the console to examine the response
            console.log(ChampId);
        });
}

getChampList();

Join in the discussion - add comment below:

Login / Signup to post new comments