applyTemplateUpdate writes key=value into currentTemplatedValues, but only when the key already exists (we never invent new template vars at replay time) and the value is actually different from the previous one.
(
logger *zap.Logger,
key, value string,
currentTemplatedValues, prevTemplatedValues map[string]interface{},
debugPath string,
)
| 2257 | // already exists (we never invent new template vars at replay time) and the value is |
| 2258 | // actually different from the previous one. |
| 2259 | func applyTemplateUpdate( |
| 2260 | logger *zap.Logger, |
| 2261 | key, value string, |
| 2262 | currentTemplatedValues, prevTemplatedValues map[string]interface{}, |
| 2263 | debugPath string, |
| 2264 | ) bool { |
| 2265 | if _, ok := currentTemplatedValues[key]; !ok { |
| 2266 | return false |
| 2267 | } |
| 2268 | prevStr := fmt.Sprintf("%v", prevTemplatedValues[key]) |
| 2269 | if prevStr == value { |
| 2270 | return false |
| 2271 | } |
| 2272 | logger.Debug("updating template value from header", |
| 2273 | zap.String("key", key), |
| 2274 | zap.String("path", debugPath), |
| 2275 | zap.String("old_value", prevStr), |
| 2276 | zap.String("new_value", value), |
| 2277 | ) |
| 2278 | currentTemplatedValues[key] = value |
| 2279 | return true |
| 2280 | } |
| 2281 | |
| 2282 | // splitSetCookieLines decomposes a yaml-stored Set-Cookie header into individual cookie lines. |
| 2283 | // Mirrors the record-side splitSetCookie in pkg/service/tools/templatize.go — kept as a small, |
no test coverage detected