Skip to content

Commit 799fa9b

Browse files
refactor(audience-sdk): drop response-body cap on OnError messages
Removes MaxErrorBodyChars (500) and the trim ternary inside ReadBodyForErrorAsync. The cap was defensive against verbose backend responses (stack traces, HTML error pages) but the audience backend returns short structured JSON for both 4xx and 5xx, making the cap dead code. Consumers now see the full response body verbatim.
1 parent 9e825b9 commit 799fa9b

1 file changed

Lines changed: 1 addition & 10 deletions

File tree

src/Packages/Audience/Runtime/Transport/HttpTransport.cs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -282,11 +282,6 @@ private static async Task<int> ParseRejectedCount(HttpResponseMessage response)
282282
}
283283
}
284284

285-
// Cap the response-body excerpt the caller sees. Backends sometimes
286-
// return verbose stack traces or HTML error pages; trimming keeps
287-
// OnError consumers (loggers, UI) from being flooded.
288-
private const int MaxErrorBodyChars = 500;
289-
290285
// Best-effort body extraction; null on read failure.
291286
// Catches narrowed so OOM, OperationCanceledException, and ThreadAbortException
292287
// propagate — body extraction must not mask process-level faults.
@@ -295,11 +290,7 @@ private static async Task<int> ParseRejectedCount(HttpResponseMessage response)
295290
try
296291
{
297292
var body = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
298-
if (string.IsNullOrWhiteSpace(body)) return null;
299-
body = body.Trim();
300-
return body.Length > MaxErrorBodyChars
301-
? body.Substring(0, MaxErrorBodyChars) + "…"
302-
: body;
293+
return string.IsNullOrWhiteSpace(body) ? null : body.Trim();
303294
}
304295
catch (HttpRequestException) { return null; }
305296
catch (IOException) { return null; }

0 commit comments

Comments
 (0)