.NET: [Feature Branch] Update HTTP API to be consistent across languages (#2118)

This commit is contained in:
Chris Gillum
2025-11-12 08:55:53 -08:00
committed by GitHub
Unverified
parent 586238c1c3
commit 2329bd4841
5 changed files with 283 additions and 51 deletions
@@ -73,7 +73,7 @@ public sealed class SamplesValidation(ITestOutputHelper outputHelper) : IAsyncLi
this._outputHelper.WriteLine($"Agent run response: {responseText}");
// The response headers should include the agent thread ID, which can be used to continue the conversation.
string? threadId = response.Headers.GetValues("X-Agent-Thread")?.FirstOrDefault();
string? threadId = response.Headers.GetValues("x-ms-thread-id")?.FirstOrDefault();
Assert.NotNull(threadId);
this._outputHelper.WriteLine($"Agent thread ID: {threadId}");
@@ -286,7 +286,7 @@ public sealed class SamplesValidation(ITestOutputHelper outputHelper) : IAsyncLi
this._outputHelper.WriteLine($"Agent response: {startResponseText}");
// The response should be deserializable as an AgentRunResponse object and have a valid thread ID
startResponse.Headers.TryGetValues("X-Agent-Thread", out IEnumerable<string>? agentIdValues);
startResponse.Headers.TryGetValues("x-ms-thread-id", out IEnumerable<string>? agentIdValues);
string? threadId = agentIdValues?.FirstOrDefault();
Assert.NotNull(threadId);
Assert.StartsWith("@dafx-publisher@", threadId);
@@ -307,7 +307,7 @@ public sealed class SamplesValidation(ITestOutputHelper outputHelper) : IAsyncLi
timeout: TimeSpan.FromSeconds(60));
// Approve the content
Uri approvalUri = new($"{runAgentUri}?threadId={threadId}");
Uri approvalUri = new($"{runAgentUri}?thread_id={threadId}");
using HttpContent approvalContent = new StringContent("Approve the content", Encoding.UTF8, "text/plain");
using HttpResponseMessage approvalResponse = await s_sharedHttpClient.PostAsync(approvalUri, approvalContent);
Assert.True(approvalResponse.IsSuccessStatusCode, $"Approve content request failed with status: {approvalResponse.StatusCode}");
@@ -327,7 +327,7 @@ public sealed class SamplesValidation(ITestOutputHelper outputHelper) : IAsyncLi
timeout: TimeSpan.FromSeconds(60));
// Verify the final orchestration status by asking the agent for the status
Uri statusUri = new($"{runAgentUri}?threadId={threadId}");
Uri statusUri = new($"{runAgentUri}?thread_id={threadId}");
await this.WaitForConditionAsync(
condition: async () =>
{