Skip to content

Commit c960f49

Browse files
committed
simplify isUrlKey
1 parent 3a1d18d commit c960f49

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

pkg/response/optimize.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -274,11 +274,10 @@ func trimArrayFields(items []any, fields []string) []any {
274274

275275
// isURLKey matches "url", "*_url", and their dot-prefixed variants.
276276
func isURLKey(key string) bool {
277-
base := key
278-
if idx := strings.LastIndex(base, "."); idx >= 0 {
279-
base = base[idx+1:]
277+
if idx := strings.LastIndex(key, "."); idx >= 0 {
278+
key = key[idx+1:]
280279
}
281-
return base == "url" || strings.HasSuffix(base, "_url")
280+
return key == "url" || strings.HasSuffix(key, "_url")
282281
}
283282

284283
func isZeroValue(v any) bool {

0 commit comments

Comments
 (0)