Browse Source

feat(plugin):reset API Header basic auth

EMqmyd 4 years ago
parent
commit
ac8c66d854
2 changed files with 3 additions and 3 deletions
  1. 2 2
      etc/sinks/rest.json
  2. 1 1
      plugins/sinkMeta.go

+ 2 - 2
etc/sinks/rest.json

@@ -95,10 +95,10 @@
     },
     },
     {
     {
       "name": "headers",
       "name": "headers",
-      "default": [],
+      "default": {},
       "optional": true,
       "optional": true,
       "control": "list",
       "control": "list",
-      "type": "list_object",
+      "type": "object",
       "hint": {
       "hint": {
         "en_US": "The additional headers to be set for the HTTP request.",
         "en_US": "The additional headers to be set for the HTTP request.",
         "zh_CN": "要为 HTTP 请求设置的其他标头"
         "zh_CN": "要为 HTTP 请求设置的其他标头"

+ 1 - 1
plugins/sinkMeta.go

@@ -273,7 +273,7 @@ func (this *uiSinks) modifyCustom(uiFields []*field, ruleFields map[string]inter
 		if nil == ruleVal {
 		if nil == ruleVal {
 			continue
 			continue
 		}
 		}
-		if reflect.Map == reflect.TypeOf(ruleVal).Kind() {
+		if reflect.Map == reflect.TypeOf(ruleVal).Kind() && "object" != ui.Type {
 			var auxRuleFields map[string]interface{}
 			var auxRuleFields map[string]interface{}
 			if err := common.MapToStruct(ruleVal, &auxRuleFields); nil != err {
 			if err := common.MapToStruct(ruleVal, &auxRuleFields); nil != err {
 				return fmt.Errorf(`%s%v %s`, getMsg(this.language, sink, "type_conversion_fail"), err, ui.Name)
 				return fmt.Errorf(`%s%v %s`, getMsg(this.language, sink, "type_conversion_fail"), err, ui.Name)