From 5bf6bd5c53446154d3e7e7c5343e9e68add6170e Mon Sep 17 00:00:00 2001 From: Jonathan Cardenas Date: Mon, 18 May 2026 21:49:37 -0700 Subject: [PATCH 1/2] Add Payload.Head project reference to Spector test suite Wire the existing generated Payload.Head stub project into the Spector.Tests project by adding a ProjectReference entry. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../TestProjects/Spector.Tests/TestProjects.Spector.Tests.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/http-client-csharp/generator/TestProjects/Spector.Tests/TestProjects.Spector.Tests.csproj b/packages/http-client-csharp/generator/TestProjects/Spector.Tests/TestProjects.Spector.Tests.csproj index 906ffbe2cc8..8692c20c097 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector.Tests/TestProjects.Spector.Tests.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector.Tests/TestProjects.Spector.Tests.csproj @@ -45,6 +45,7 @@ + From 813a9bfcfca559039f45521444094fad1afa58a1 Mon Sep 17 00:00:00 2001 From: Jonathan Cardenas Date: Mon, 18 May 2026 21:49:44 -0700 Subject: [PATCH 2/2] Add contentTypeHeaderInResponse Spector test Add test class for the Payload.Head scenario covering the contentTypeHeaderInResponse HEAD operation with response headers. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../Http/Payload/Head/HeadTests.cs | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector.Tests/Http/Payload/Head/HeadTests.cs diff --git a/packages/http-client-csharp/generator/TestProjects/Spector.Tests/Http/Payload/Head/HeadTests.cs b/packages/http-client-csharp/generator/TestProjects/Spector.Tests/Http/Payload/Head/HeadTests.cs new file mode 100644 index 00000000000..2cafbe86d7c --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector.Tests/Http/Payload/Head/HeadTests.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Threading.Tasks; +using NUnit.Framework; +using Payload.Head; + +namespace TestProjects.Spector.Tests.Http.Payload.Head +{ + public class HeadTests : SpectorTestBase + { + [SpectorTest] + public Task ContentTypeHeaderInResponse() => Test(async (host) => + { + var response = await new HeadClient(host, null).ContentTypeHeaderInResponseAsync(); + var rawResponse = response.GetRawResponse(); + Assert.AreEqual(200, rawResponse.Status); + Assert.IsTrue(rawResponse.Headers.TryGetValue("Content-Type", out string? contentType)); + Assert.AreEqual("text/plain; charset=utf-8", contentType); + Assert.IsTrue(rawResponse.Headers.TryGetValue("x-ms-meta", out string? metadata)); + Assert.AreEqual("hello", metadata); + }); + } +}