'use strict'; class CustomizeWebhookDriver { constructor(ctx, options = {}) { this.ctx = ctx; this.options = options; } async send({ hook, payload }) { const requestOptions = { method: 'POST', headers: { 'content-type': 'application/json', }, timeout: 5000, dataType: 'json', contentType: 'json', data: payload, }; const response = await this.ctx.curl(String(hook.hook_url || ''), requestOptions); return { hookId: Number(hook && hook.id) || 0, hookType: String(hook && hook.hook_type || this.options.hookType || 'customize'), hookUrl: String(hook && hook.hook_url || ''), status: Number(response && response.status) || 200, response: response && response.data !== undefined ? response.data : null, }; } } module.exports = CustomizeWebhookDriver;