forked from bitfocus/companion-module-generic-http
-
Notifications
You must be signed in to change notification settings - Fork 0
/
upgrade.js
36 lines (31 loc) · 804 Bytes
/
upgrade.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
export const upgradeScripts = [
function v1_1_4(context, props) {
const result = {
updatedConfig: null,
updatedActions: [],
updatedFeedbacks: [],
}
for (const action of props.actions) {
// set default content-type on older actions
if (['post', 'put', 'patch'].includes(action.actionId)) {
if (action.options.contenttype === undefined) {
action.options.contenttype = 'application/json'
result.updatedActions.push(action)
}
}
}
return result
},
function v1_1_6(context, props) {
const result = {
updatedConfig: null,
updatedActions: [],
updatedFeedbacks: [],
}
if (props.config && props.config.rejectUnauthorized === undefined) {
props.config.rejectUnauthorized = true
result.updatedConfig = props.config
}
return result
},
]