Skip to content

update to fast api V2 #23

@robledosm

Description

@robledosm

Just made some changes on getTargets() to update to fast api V2, replaced the "while contents" with this

    while (targets.length < this.urlCount) {
      /* eslint-disable no-await-in-loop */
      const { response } = await this.get(`http${this.https ? 's' : ''}://api.fast.com/netflix/speedtest/v2?https=${this.https ? 'true' : 'false'}&token=${this.token}&urlCount=${this.urlCount - targets.length}`);
      /* eslint-enable no-await-in-loop */
      if (response.statusCode !== 200) {
        if (response.statusCode === 403) {
          throw new ApiError({ code: ApiError.CODES.BAD_TOKEN });
        }
        throw new ApiError({ code: ApiError.CODES.UNKNOWN });
      }
      targets.push(...response.data.targets);
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions