Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
paglias committed Feb 20, 2018
1 parent 0cb4fa6 commit 73f8923
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions website/server/libs/webhook.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
import got from 'got';
import { isURL } from 'validator';
import logger from './logger';
import nconf from 'nconf';

async function sendWebhook (url, body) {
try {
await got.post(url, {
body,
json: true,
});
} catch (err) {
logger.error(err);
}
const IS_PRODUCTION = nconf.get('IS_PROD');

function sendWebhook (url, body) {
got.post(url, {
body,
json: true,
}).catch(err => logger.error(err));
}

function isValidWebhook (hook) {
return hook.enabled && isURL(hook.url);
return hook.enabled && isURL(hook.url, {
require_tld: IS_PRODUCTION ? true : false, // eslint-disable-line camelcase
});
}

export class WebhookSender {
Expand Down

0 comments on commit 73f8923

Please sign in to comment.