@@ -268,10 +268,7 @@ func BuildCacheKeyParams(data map[string]interface{}) (types.RequestParams, erro
268268 }
269269 }
270270
271- // Normalize all other parameters through the alias index if available.
272- // Also, filter to only those canonical parameters that are required for this endpoint
273- // when we have requirement metadata.
274- requiredForEndpoint , haveReq := activeAliasIndex .requiredParams [canonicalEndpoint ]
271+ overriddenKeys := make (map [string ]bool )
275272
276273 for k , v := range data {
277274 // Ignore the `endpoint` and `overrides` keys.
@@ -287,35 +284,30 @@ func BuildCacheKeyParams(data map[string]interface{}) (types.RequestParams, erro
287284 continue
288285 }
289286
287+ canonicalKey := keyLower
288+ if pm , ok := activeAliasIndex .paramAlias [canonicalEndpoint ]; ok {
289+ if pIdx , ok := pm [keyLower ]; ok {
290+ canonicalKey = pIdx .CanonicalName
291+ }
292+ }
293+
290294 value := rawValue
291295
292296 // If there are per-adapter overrides, and the current value has an
293297 // override defined for the active adapter, use the override instead.
294298 if adapterOverrides != nil {
295299 if ov , ok := adapterOverrides [strings .ToUpper (rawValue )]; ok && ov != "" {
296300 value = ov
301+ overriddenKeys [canonicalKey ] = true
297302 }
298303 }
299304
300- valueUpper := strings .ToUpper (value )
301-
302- canonicalKey := keyLower
303- if pm , ok := activeAliasIndex .paramAlias [canonicalEndpoint ]; ok {
304- if pIdx , ok := pm [keyLower ]; ok {
305- canonicalKey = pIdx .CanonicalName
306- }
307- }
308-
309- // If we don't have requirement metadata for this endpoint, keep all params.
310- if ! haveReq {
311- out [canonicalKey ] = valueUpper
312- continue
313- }
305+ out [canonicalKey ] = strings .ToUpper (value )
306+ }
314307
315- // Otherwise, only keep parameters that are marked as required.
316- if required , ok := requiredForEndpoint [canonicalKey ]; ok && required {
317- out [canonicalKey ] = valueUpper
318- }
308+ // Apply adapter-specific cache key transform if registered.
309+ if transform , ok := adapterTransforms [activeAdapter ]; ok {
310+ transform (out , overriddenKeys )
319311 }
320312
321313 return out , nil
0 commit comments