(key string, params []string)
| 72 | } |
| 73 | |
| 74 | func (h *Http) UpdateDirective(key string, params []string) { |
| 75 | if key == "" || len(params) == 0 { |
| 76 | return |
| 77 | } |
| 78 | directives := h.GetDirectives() |
| 79 | index := -1 |
| 80 | for i, dir := range directives { |
| 81 | if dir.GetName() == key { |
| 82 | if IsRepeatKey(key) { |
| 83 | oldParams := dir.GetParameters() |
| 84 | if !(len(oldParams) > 0 && oldParams[0] == params[0]) { |
| 85 | continue |
| 86 | } |
| 87 | } |
| 88 | index = i |
| 89 | break |
| 90 | } |
| 91 | } |
| 92 | newDirective := &Directive{ |
| 93 | Name: key, |
| 94 | Parameters: params, |
| 95 | } |
| 96 | if index > -1 { |
| 97 | directives[index] = newDirective |
| 98 | } else { |
| 99 | directives = append(directives, newDirective) |
| 100 | } |
| 101 | h.Directives = directives |
| 102 | } |
| 103 | |
| 104 | func (h *Http) RemoveDirective(key string, params []string) { |
| 105 | directives := h.GetDirectives() |
nothing calls this directly
no test coverage detected