Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Translation\TranslatorInterface;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Constraints\Url;

/**
* Class CampaignEventRemoteUrlType.
Expand Down Expand Up @@ -50,11 +49,6 @@ public function buildForm(FormBuilderInterface $builder, array $options)
'attr' => ['class' => 'form-control'],
'required' => true,
'constraints' => [
new Url(
[
'message' => 'mautic.form.submission.url.invalid',
]
),
new NotBlank(
[
'message' => 'mautic.core.value.required',
Expand Down
7 changes: 6 additions & 1 deletion app/bundles/WebhookBundle/Helper/CampaignHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ public function fireWebhook(array $config, Lead $contact)
// dump($config);die;
$payload = $this->getPayload($config, $contact);
$headers = $this->getHeaders($config, $contact);
$this->makeRequest($config['url'], $config['method'], $config['timeout'], $headers, $payload);
$url = rawurldecode(TokenHelper::findLeadTokens($config['url'], $this->getContactValues($contact), true));
$this->makeRequest($url, $config['method'], $config['timeout'], $headers, $payload);
}

/**
Expand Down Expand Up @@ -91,6 +92,10 @@ private function makeRequest($url, $method, $timeout, array $headers, array $pay
case 'post':
case 'put':
case 'patch':
$headers = array_change_key_case($headers);
if (array_key_exists('content-type', $headers) && 'application/json' == strtolower($headers['content-type'])) {
$payload = json_encode($payload);
}
$response = $this->connector->$method($url, $payload, $headers, $timeout);
break;
case 'delete':
Expand Down