Fix headers when using node-fetch

This commit is contained in:
Ajay Ramachandran 2021-01-17 21:18:22 -05:00
parent acc9537bb7
commit 4561148ab2
3 changed files with 13 additions and 3 deletions

View file

@ -82,7 +82,10 @@ function sendWebhooks(userID: string, videoID: string, UUID: string, segmentInfo
"url": data.items[0].snippet.thumbnails.maxres ? data.items[0].snippet.thumbnails.maxres.url : "",
},
}],
})
}),
headers: {
'Content-Type': 'application/json'
}
})
.then(res => {
if (res.status >= 400) {
@ -136,7 +139,10 @@ function sendWebhooksNB(userID: string, videoID: string, UUID: string, startTime
"url": ytData.items[0].snippet.thumbnails.maxres ? ytData.items[0].snippet.thumbnails.maxres.url : "",
},
}],
})
}),
headers: {
'Content-Type': 'application/json'
}
})
.then(res => {
if (res.status >= 400) {

View file

@ -113,7 +113,10 @@ function sendWebhooks(voteData: VoteData) {
"url": data.items[0].snippet.thumbnails.maxres ? data.items[0].snippet.thumbnails.maxres.url : "",
},
}],
})
}),
headers: {
'Content-Type': 'application/json'
}
})
.then(async res => {
if (res.status >= 400) {

View file

@ -42,6 +42,7 @@ function dispatchEvent(scope: string, data: any): void {
headers: {
"Authorization": authKey,
"Event-Type": scope, // Maybe change this in the future?
'Content-Type': 'application/json'
},
})
.catch(err => {