Webhook fails if optional fields are empty

(#5053) Bug Open: Needs triage

Reproduction steps

Send the following curl command to a Fluxer webhook
curl --connect-timeout 3 -sSL \
  -H "Content-Type: application/json" \
  -X POST \
  --data-binary @- \
  "WEBHOOK URL" <<'JSON'
{
  "username": "LinuxGSM",
  "avatar_url": "https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/master/lgsm/data/alert_discord_logo.jpg",
  "embeds": [
    {
      "author": {
        "name": "LinuxGSM Alert",
        "url": "",
        "icon_url": "https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/master/lgsm/data/alert_discord_logo.jpg"
      },
      "title": "🚧 Tested - xinayder's den | EU #1 | Vanilla 🚧",
      "description": "",
      "url": "",
      "thumbnail": {
        "url": "https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/master/lgsm/data/gameicons/tf2c-icon.png"
      },
      "fields": [
        {
          "name": "Server Name",
          "value": "xinayder's den | EU #1 | Vanilla"
        },
        {
          "name": "Information",
          "value": "Testing tf2cserver LinuxGSM Alert. No action to be taken."
        },
        {
          "name": "Game",
          "value": "Team Fortress 2 Classified",
          "inline": true
        },
        {
          "name": "Server IP",
          "value": "`xx.xx.xx.xx:27015`",
          "inline": true
        },
        {
          "name": "Server Time",
          "value": "Sat Nov 28 10:17:12 PM UTC 2026",
          "inline": true
        },
        {
          "name": "Is my Game Server Online?",
          "value": "https://ismygameserver.online/valve/xx.xx.xx.xx:27015"
        }
      ],
      "footer": {
        "icon_url": "https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/master/lgsm/data/alert_discord_logo.jpg",
        "text": "Sent by LinuxGSM v26.6.0"
      }
    }
  ]
}
JSON

Expected behaviour

The webhook gets parsed correctly and a message is sent to the specified channel

Actual behaviour

{
   "code":"INVALID_FORM_BODY",
   "message":"Invalid form body.",
   "errors":[
      {
         "path":"embeds.0.url",
         "message":"URL must be between 1 and 2048 characters.",
         "code":"URL_LENGTH_INVALID"
      },
      {
         "path":"embeds.0.url",
         "message":"Invalid URL format.",
         "code":"INVALID_URL_FORMAT"
      },
      {
         "path":"embeds.0.author.url",
         "message":"URL must be between 1 and 2048 characters.",
         "code":"URL_LENGTH_INVALID"
      },
      {
         "path":"embeds.0.author.url",
         "message":"Invalid URL format.",
         "code":"INVALID_URL_FORMAT"
      }
   ]
}

Build information

Stable Web 2026.1127.154244, Linux (x64), Firefox 160.0, Locale en-US

Platform

API

1 comment

Sign in with Fluxer to comment and vote.
Comment by xinayder
xinayder OP1 vote
IMO, empty strings in the API fields should be treated as if the field is null/does not exist. In golang, you can add a tag to the JSON parser called omitifempty, meaning it will just delete the field if its value is empty. Not sure if something similar exists in Rust.