diff options
Diffstat (limited to 'recipes/mattermost/index.js')
-rw-r--r-- | recipes/mattermost/index.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/recipes/mattermost/index.js b/recipes/mattermost/index.js new file mode 100644 index 0000000..8f814fa --- /dev/null +++ b/recipes/mattermost/index.js | |||
@@ -0,0 +1,20 @@ | |||
1 | "use strict"; | ||
2 | |||
3 | module.exports = Franz => class Mattermost extends Franz { | ||
4 | async validateUrl(url) { | ||
5 | try { | ||
6 | const resp = await window.fetch(url, { | ||
7 | method: 'GET', | ||
8 | headers: { | ||
9 | 'Content-Type': 'application/json' | ||
10 | } | ||
11 | }); | ||
12 | return resp.status.toString().startsWith('2'); | ||
13 | } catch (err) { | ||
14 | console.error(err); | ||
15 | } | ||
16 | |||
17 | return false; | ||
18 | } | ||
19 | |||
20 | }; \ No newline at end of file | ||