diff options
Diffstat (limited to 'recipes/rocketchat/index.js')
-rw-r--r-- | recipes/rocketchat/index.js | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/recipes/rocketchat/index.js b/recipes/rocketchat/index.js index a7fee29..a89bd61 100644 --- a/recipes/rocketchat/index.js +++ b/recipes/rocketchat/index.js | |||
@@ -1,18 +1,19 @@ | |||
1 | module.exports = Ferdium => class RocketChat extends Ferdium { | 1 | module.exports = Ferdium => |
2 | async validateUrl(url) { | 2 | class RocketChat extends Ferdium { |
3 | try { | 3 | async validateUrl(url) { |
4 | const resp = await window.fetch(url, { | 4 | try { |
5 | method: 'GET', | 5 | const resp = await window.fetch(url, { |
6 | headers: { | 6 | method: 'GET', |
7 | 'Content-Type': 'application/json', | 7 | headers: { |
8 | }, | 8 | 'Content-Type': 'application/json', |
9 | }); | 9 | }, |
10 | const status = resp.status.toString(); | 10 | }); |
11 | return status.startsWith('2') || status.startsWith('3'); | 11 | const status = resp.status.toString(); |
12 | } catch (error) { | 12 | return status.startsWith('2') || status.startsWith('3'); |
13 | console.error(error); | 13 | } catch (error) { |
14 | } | 14 | console.error(error); |
15 | } | ||
15 | 16 | ||
16 | return false; | 17 | return false; |
17 | } | 18 | } |
18 | }; | 19 | }; |