aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/rocketchat/index.js
blob: 54450ce0e4deea086b7de6c10b57e7e861b9a783 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
"use strict";

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;
  }

};