Browse Source

[Fix]Added request header validation (#9915)

labbomb 3 years ago
parent
commit
c9bba819bd

+ 1 - 0
dolphinscheduler-ui/src/locales/modules/en_US.ts

@@ -725,6 +725,7 @@ const project = {
     task_manager_number_tips: 'Please enter TaskManager number',
     http_url: 'Http Url',
     http_url_tips: 'Please Enter Http Url',
+    http_url_validator: 'The request address must contain HTTP or HTTPS',
     http_method: 'Http Method',
     http_parameters: 'Http Parameters',
     http_check_condition: 'Http Check Condition',

+ 1 - 0
dolphinscheduler-ui/src/locales/modules/zh_CN.ts

@@ -715,6 +715,7 @@ const project = {
     task_manager_number_tips: '请输入TaskManager数量',
     http_url: '请求地址',
     http_url_tips: '请填写请求地址(必填)',
+    http_url_validator: '请求地址需包含http或者https',
     http_method: '请求类型',
     http_parameters: '请求参数',
     http_check_condition: '校验条件',

+ 3 - 0
dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-http.ts

@@ -55,6 +55,9 @@ export function useHttp(model: { [field: string]: any }): IJsonItem[] {
           if (!value) {
             return new Error(t('project.node.http_url_tips'))
           }
+          if (value.search(new RegExp('http[s]{0,1}:\/\/([\w.]+\/?)\S*', 'i'))) {
+            return new Error(t('project.node.http_url_validator'))
+          }
         }
       }
     },