aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/rocketchat/index.js
blob: 499053a0dbbbfa5401c273aa291a84baab6f74f6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
module.exports = Franz => class RocketChat extends Franz {
  async validateUrl(url) {
    try {
      const resp = await window.fetch(url, {
        method: 'GET',
        headers: {
          'Content-Type': 'application/json',
        },
      });
      const status = resp.status.toString();
      return status.startsWith('2') || status.startsWith('3');
    } catch (err) {
      console.error(err);
    }

    return false;
  }
};