From 2fe75281d05a426474832e2697acac1a6877415e Mon Sep 17 00:00:00 2001 From: Scott Beddall <45376673+scbedd@users.noreply.github.com> Date: Mon, 9 Dec 2024 10:57:42 -0800 Subject: [PATCH] restore test-proxy error response to before typespec creation (#9496) --- .../Common/HttpExceptionMiddleware.cs | 6 +++--- tools/test-proxy/typespec/main.tsp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Common/HttpExceptionMiddleware.cs b/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Common/HttpExceptionMiddleware.cs index de3b864314c..f39023cd0f0 100644 --- a/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Common/HttpExceptionMiddleware.cs +++ b/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Common/HttpExceptionMiddleware.cs @@ -56,11 +56,11 @@ public async Task Invoke(HttpContext context) response.Headers.Append("x-request-known-exception", "true"); response.Headers.Append("x-request-known-exception-error", encodedException); } - + var bodyObj = new { Message = e.Message, - Status = e.StatusCode + Status = e.StatusCode.ToString() }; DebugLogger.LogError(e.Message); @@ -85,7 +85,7 @@ public async Task Invoke(HttpContext context) var bodyObj = new { Message = e.Message, - Status = unexpectedStatusCode, + Status = unexpectedStatusCode.ToString(), StackTrace = e.StackTrace, }; diff --git a/tools/test-proxy/typespec/main.tsp b/tools/test-proxy/typespec/main.tsp index a99ce07abd7..672a57c006c 100644 --- a/tools/test-proxy/typespec/main.tsp +++ b/tools/test-proxy/typespec/main.tsp @@ -16,7 +16,7 @@ model StartPayload { model CommonErrorResponse { Message: string; - Status: int32; + Status: string; StackTrace?: string; @header("x-request-exception") requestException: boolean; @header("x-request-exception-error") requestExceptionError: string;