Skip to content

Commit

Permalink
set user-agent header for Discord deliveries
Browse files Browse the repository at this point in the history
  • Loading branch information
cdzombak committed Jan 7, 2024
1 parent 65c5e7e commit b76e017
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion deliver.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,14 @@ func executeDiscordDelivery(cfg *discordDeliveryConfig, runOutput *runOutput) er
client := http.DefaultClient
client.Timeout = discordTimeout

resp, err := client.Post(cfg.discordWebhookURL, writer.FormDataContentType(), webhookBody)
req, err := http.NewRequest(http.MethodPost, cfg.discordWebhookURL, webhookBody)
if err != nil {
return fmt.Errorf("failed building Discord webhook HTTP request: %w", err)
}
req.Header.Set("Content-Type", writer.FormDataContentType())
req.Header.Set("User-Agent", productIdentifier())

resp, err := client.Do(req)
if err != nil {
return fmt.Errorf("failed POSTing Discord webhook: %w", err)
}
Expand Down

0 comments on commit b76e017

Please sign in to comment.