From 183f59993f68a6369922572dc4c25c71c9019e2a Mon Sep 17 00:00:00 2001 From: bransoned Date: Tue, 13 Jan 2026 21:39:42 +0000 Subject: [PATCH] Change repeated array allocation into predefined constant --- .../Services/Subsonic/SubsonicProxyService.cs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/octo-fiesta/Services/Subsonic/SubsonicProxyService.cs b/octo-fiesta/Services/Subsonic/SubsonicProxyService.cs index da4eecc..9ec61d9 100644 --- a/octo-fiesta/Services/Subsonic/SubsonicProxyService.cs +++ b/octo-fiesta/Services/Subsonic/SubsonicProxyService.cs @@ -60,6 +60,16 @@ public class SubsonicProxyService } } + private static ReadOnlySpan StreamingRequiredHeaders => + new + { + "Accept-Ranges", + "Content-Range", + "Content-Length", + "ETag", + "Last-Modified" + }; + /// /// Relays a stream request to the Subsonic server with range processing support. /// @@ -113,14 +123,7 @@ public class SubsonicProxyService outgoingResponse.StatusCode = (int)response.StatusCode; // Forward streaming-required headers from upstream response - foreach (var header in new[] - { - "Accept-Ranges", - "Content-Range", - "Content-Length", - "ETag", - "Last-Modified" - }) + foreach (var header in StreamingRequiredHeaders) { if (response.Headers.TryGetValues(header, out var values) || response.Content.Headers.TryGetValues(header, out values))