Skip to content

Commit eb5c198

Browse files
authored
Merge pull request #23 from FosterCommerce/develop
add support for put requests
2 parents 0f1a7d1 + bc7b13a commit eb5c198

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

src/Plugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public function init()
120120

121121
$view = Craft::$app->getView();
122122

123-
if ($webhook->method === 'post') {
123+
if (in_array($webhook->method, ['post', 'put'], true)) {
124124
// Build out the body data
125125
if ($webhook->payloadTemplate) {
126126
$json = $view->renderString($webhook->payloadTemplate, [

src/Webhook.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public function rules()
118118
[['name'], UniqueValidator::class, 'targetClass' => WebhookRecord::class],
119119
[['groupId'], 'number'],
120120
[['enabled'], 'boolean'],
121-
[['method'], 'in', 'range' => ['get', 'post']],
121+
[['method'], 'in', 'range' => ['get', 'post', 'put']],
122122
[
123123
['class'],
124124
function(string $attribute, array $params = null, Validator $validator) {

src/templates/_manage/edit.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@
105105
name: 'method',
106106
options: {
107107
'get': 'GET',
108-
'post': 'POST'
108+
'post': 'POST',
109+
'put': 'PUT',
109110
},
110111
value: webhook.method,
111112
toggle: true,

0 commit comments

Comments
 (0)