Skip to content

Commit 911fed7

Browse files
committed
fix(httpSend): fix params-type validation and remove redundant type params
- Fix params-type guard to check cmd.paramsType against TimelineContentTypeHTTPParamType values using Object.values().includes() instead of the `in` operator (which checks keys, not values, and was also checking the wrong field: cmd.type) - Remove redundant explicit type parameters from both Object.values() calls
1 parent fa04a27 commit 911fed7

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

  • packages/timeline-state-resolver/src/integrations/httpSend

packages/timeline-state-resolver/src/integrations/httpSend/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export class HTTPSendDevice implements Device<HttpSendDeviceTypes, HttpSendDevic
9898
context: {},
9999
}
100100
}
101-
if (!Object.values<TimelineContentTypeHTTP>(TimelineContentTypeHTTP).includes(cmd.type)) {
101+
if (!Object.values(TimelineContentTypeHTTP).includes(cmd.type)) {
102102
return {
103103
result: ActionExecutionResultCode.Error,
104104
response: t('Failed to send command: type is invalid'),
@@ -114,7 +114,7 @@ export class HTTPSendDevice implements Device<HttpSendDeviceTypes, HttpSendDevic
114114
context: { url: interpolateTemplateStringIfNeeded(cmd.url) },
115115
}
116116
}
117-
if (cmd.paramsType && !(cmd.type in TimelineContentTypeHTTPParamType)) {
117+
if (cmd.paramsType && !Object.values(TimelineContentTypeHTTPParamType).includes(cmd.paramsType)) {
118118
return {
119119
result: ActionExecutionResultCode.Error,
120120
response: t('Failed to send command: params type is invalid'),

0 commit comments

Comments
 (0)