fix: workflow http node timeout & url check (#4175)

This commit is contained in:
zxhlyh 2024-05-08 13:20:26 +08:00 committed by GitHub
parent 4aa21242b6
commit 8137d63000
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 6 deletions

View File

@ -68,7 +68,7 @@ const Timeout: FC<Props> = ({ readonly, payload, onChange }) => {
value={connect}
onChange={v => onChange?.({ ...payload, connect: v })}
min={1}
max={max_connect_timeout ?? 300}
max={max_connect_timeout || 300}
/>
<InputField
title={t('workflow.nodes.http.timeout.readLabel')!}
@ -78,7 +78,7 @@ const Timeout: FC<Props> = ({ readonly, payload, onChange }) => {
value={read}
onChange={v => onChange?.({ ...payload, read: v })}
min={1}
max={max_read_timeout ?? 600}
max={max_read_timeout || 600}
/>
<InputField
title={t('workflow.nodes.http.timeout.writeLabel')!}
@ -88,7 +88,7 @@ const Timeout: FC<Props> = ({ readonly, payload, onChange }) => {
value={write}
onChange={v => onChange?.({ ...payload, write: v })}
min={1}
max={max_write_timeout ?? 600}
max={max_write_timeout || 600}
/>
</div>
</div>

View File

@ -40,9 +40,6 @@ const nodeDefault: NodeDefault<HttpNodeType> = {
if (!errorMessages && !payload.url)
errorMessages = t('workflow.errorMsg.fieldRequired', { field: t('workflow.nodes.http.api') })
if (!errorMessages && !payload.url.startsWith('http://') && !payload.url.startsWith('https://'))
errorMessages = t('workflow.nodes.http.notStartWithHttp')
return {
isValid: !errorMessages,
errorMessage: errorMessages,