Skip to content

Commit 3410dc5

Browse files
committed
headers is a constant
1 parent c79c3fa commit 3410dc5

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

update_remote_settings_records.mjs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ const rsBrowsersCollectionEndpoint = `${process.env.SERVER}/buckets/main-workspa
4949
const rsBrowsersRecordsEndpoint = `${rsBrowsersCollectionEndpoint}/records`;
5050
const isDryRun = process.env.DRY_RUN == "1";
5151

52-
const headers = {
52+
const HEADERS = {
5353
"Content-Type": "application/json",
5454
Authorization: process.env.AUTHORIZATION.startsWith("Bearer ")
5555
? process.env.AUTHORIZATION
@@ -158,7 +158,7 @@ async function getRSRecords() {
158158
console.log(`Get existing records from ${rsBrowsersCollectionEndpoint}`);
159159
const response = await fetch(rsBrowsersRecordsEndpoint, {
160160
method: "GET",
161-
headers,
161+
headers: HEADERS,
162162
});
163163
if (response.status !== 200) {
164164
throw new Error(
@@ -189,7 +189,7 @@ async function createRecord(browserMdn) {
189189
const response = await fetch(`${rsBrowsersRecordsEndpoint}`, {
190190
method: "POST",
191191
body: JSON.stringify({ data: browserMdn }),
192-
headers,
192+
headers: HEADERS,
193193
});
194194
const succesful = response.status == 201;
195195
if (!succesful) {
@@ -222,7 +222,7 @@ async function updateRecord(record, browserMdn) {
222222
const response = await fetch(`${rsBrowsersRecordsEndpoint}/${record.id}`, {
223223
method: "PUT",
224224
body: JSON.stringify({ data: browserMdn }),
225-
headers,
225+
headers: HEADERS,
226226
});
227227
const succesful = response.status == 200;
228228
if (!succesful) {
@@ -252,7 +252,7 @@ async function deleteRecord(record) {
252252

253253
const response = await fetch(`${rsBrowsersRecordsEndpoint}/${record.id}`, {
254254
method: "DELETE",
255-
headers,
255+
headers: HEADERS,
256256
});
257257
const succesful = response.status == 200;
258258
if (!succesful) {
@@ -275,7 +275,7 @@ async function requestReview() {
275275
const response = await fetch(rsBrowsersCollectionEndpoint, {
276276
method: "PATCH",
277277
body: JSON.stringify({ data: { status: "to-review" } }),
278-
headers,
278+
headers: HEADERS,
279279
});
280280
if (response.status === 200) {
281281
console.log("Review requested ✅");
@@ -299,7 +299,7 @@ async function approveChanges() {
299299
const response = await fetch(rsBrowsersCollectionEndpoint, {
300300
method: "PATCH",
301301
body: JSON.stringify({ data: { status: "to-sign" } }),
302-
headers,
302+
headers: HEADERS,
303303
});
304304
if (response.status === 200) {
305305
console.log("Changes approved ✅");

0 commit comments

Comments
 (0)