From 380e25b4f08f9b8991503fb914d4693a474822d2 Mon Sep 17 00:00:00 2001 From: rofe Date: Wed, 1 Jul 2020 20:53:41 +0200 Subject: [PATCH] refactor(newrelic): use URLSearchParams --- src/newrelic/alerts.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/newrelic/alerts.js b/src/newrelic/alerts.js index 84b75b1..36e21a8 100644 --- a/src/newrelic/alerts.js +++ b/src/newrelic/alerts.js @@ -254,8 +254,12 @@ async function updatePolicy(auth, policy, groupPolicy, monitorId, channelId, pol method: 'PUT', headers: { 'X-Api-Key': auth, + 'Content-Type': 'application/x-www-form-urlencoded', }, - body: `channel_ids=${encodeURIComponent(channelId)}&policy_id=${encodeURIComponent(policy.id)}`, + body: new URLSearchParams({ + channel_ids: channelId, + policy_id: policy.id, + }).toString(), }); const body = await resp.text(); if (!resp.ok) {