Closed splatterxl closed 2 years ago
can you provide a curl
sample we can test with? I am not able to reproduce any issues locally. If the issue is happening upstream (like in the HTTP layer) it is not likely we can return any error but a 500.
Sure! cURL reproduction script:
curl -H "Authorization: Bot $DISCORD_TOKEN" -i \
-XPOST -F "files[0]=@data.json" -F "payload_json=$(cat data.txt)" \
https://discord.com/api/v10/channels/$CHANNEL_ID/messages
data.txt
:
{"content":"pong","flags":0,"tts":false,"nonce":1649794889919,"embeds":null,"attachments":[{"options":{"data":"{ \"content\": \"pong\" }","name":"ping.json","description":"pong"},"name":"ping.json","data":{"type":"Buffer","data":[123,32,34,99,111,110,116,101,110,116,34,58,32,34,112,111,110,103,34,32,125]},"contentType":"image/png","description":"pong"},{"id":"0","filename":"ping.json","description":"pong"},{"id":"0","filename":"ping.json","description":"pong"}]}
data.json
is just:
{
"content": "pong"
}
and this all returns
{"message": "500: Internal Server Error", "code": 0}
Thanks for the additional information. This will be fixed in the next API deploy.
Description
When calling Create Message (
POST /channels/:channel_id/messages
) with malformed data from incorrect encoding of attachments, the server returns 500 Internal Server Error instead of a 400 Bad Request response with the corresponding error.Steps to Reproduce
Expected Behavior
The server would respond with a 400 Bad Request error informing me that my data is horribly wrong.
Current Behavior
The server responds with 500 Internal Server Error.
Screenshots/Videos
No response
Client and System Information