-
Notifications
You must be signed in to change notification settings - Fork 48
Description
Description
When unpacking a 400 response from a webhook send I noticed that it was returning a simple HttpResultError (Code=400, Reason=Bad Request) despite the response containing content that explains the error in detail. Reading the response content using ReadAsStringAsync via the debugger correctly lets the library create the error object
Steps to Reproduce
Result<IMessage?> webhookResult = await _webhookApi.ExecuteWebhookAsync(<webhook id>, <webhook token>, content: "test", allowedMentions: new AllowedMentions(Parse: new[] { MentionType.Users }, Users: new Snowflake[] { new(0)) })); //This is code I had that triggered the bugExpected Behavior
The response given in postman is {"allowed_mentions": ["parse:[\"users\"] and users: [ids...] are mutually exclusive."]}. This should resolve to a RestResultError when the content is read by UnpackResponseAsync.
In UnpackResonseAsync at like line ~654 of HttpRestClient, response.Content.Headers.ContentLength should be a positive integer but is instead null unless read manually in the debugger
Current Behavior
The error in the result is simply an HttpResultError
Library / Runtime Information
net8.0
Remora.Discord 2024.1.0