Skip to content

Commit

Permalink
Merge webhook url with ?wait=true
Browse files Browse the repository at this point in the history
I want to post notifications to a thread, so I need to provide the url with ?thread_id=123, but original code would make it ?thread_id=123?wait=true

so use built in url parsing library to merge the params
  • Loading branch information
halkeye authored Jan 21, 2024
1 parent a90470c commit 66aee38
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion discord-commits/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ const payload = {
}

try {
await fetch(`${webhook}?wait=true`, {
const webhookURL = new URL(webhook);
webhookURL.searchParams.set('wait','true');
await fetch(webhookURL.toString(), {
method: 'POST',
headers: {
"Content-Type": "application/json",
Expand Down

0 comments on commit 66aee38

Please sign in to comment.