Skip to content

Commit 5952f96

Browse files
committed
Added PUT and PATCH methods
1 parent 0f3d759 commit 5952f96

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/ButtonPanel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ export class ButtonPanel extends PureComponent<Props, ButtonPanelState> {
106106
//referrerPolicy: 'no-referrer', // no-referrer, *no-referrer-when-downgrade, origin, origin-when-cross-origin, same-origin, strict-origin, strict-origin-when-cross-origin, unsafe-url
107107
};
108108

109-
if (options.method === 'POST') {
109+
if (options.method === 'POST' || options.method == 'PUT' || options.method == 'PATCH') {
110110
requestHeaders.set('Content-Type', options.contentType);
111111
if (options.payload) {
112112
fetchOpts.body = this.interpolateVariables(options.payload);

src/module.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@ export const plugin = new PanelPlugin<ButtonPanelOptions>(ButtonPanel).setPanelO
2424
value: 'POST',
2525
label: 'POST',
2626
},
27+
{
28+
value: 'PUT',
29+
label: 'PUT',
30+
},
31+
{
32+
value: 'PATCH',
33+
label: 'PATCH',
34+
},
2735
{
2836
value: 'DELETE',
2937
label: 'DELETE',
@@ -82,7 +90,7 @@ export const plugin = new PanelPlugin<ButtonPanelOptions>(ButtonPanel).setPanelO
8290
{ label: 'text/plain', value: 'text/plain' },
8391
],
8492
},
85-
showIf: (config) => config.method === 'POST',
93+
showIf: (config) => (config.method === 'POST' || config.method == 'PUT' || config.method == 'PATCH'),
8694
})
8795
.addCustomEditor({
8896
id: 'payload',
@@ -103,7 +111,7 @@ export const plugin = new PanelPlugin<ButtonPanelOptions>(ButtonPanel).setPanelO
103111
}
104112
},
105113
},
106-
showIf: (config) => config.method === 'POST',
114+
showIf: (config) => (config.method === 'POST' || config.method == 'PUT' || config.method == 'PATCH'),
107115
editor: ButtonPayloadEditor,
108116
})
109117
.addSelect({

0 commit comments

Comments
 (0)