correctly send the json body

This commit is contained in:
Emilien Devos 2024-04-22 00:03:29 +02:00
parent ea4d456cb4
commit f14d71df20
2 changed files with 3 additions and 7 deletions

View File

@ -1,4 +1,4 @@
name: Add instance to uptimerobot name: Add instance to updown.io
on: on:
issues: issues:
@ -54,7 +54,6 @@ jobs:
var request = require("request"); var request = require("request");
var optionsAddNewCheck = { method: 'POST', var optionsAddNewCheck = { method: 'POST',
url: 'https://updown.io/api/checks?api-key=${{ secrets.UPDOWN_API_KEY }}', url: 'https://updown.io/api/checks?api-key=${{ secrets.UPDOWN_API_KEY }}',
json:true,
headers: headers:
{ 'content-type': 'application/x-www-form-urlencoded' }, { 'content-type': 'application/x-www-form-urlencoded' },
form: form:
@ -72,8 +71,7 @@ jobs:
if (body.token) { if (body.token) {
var optionsGetStatusPages = { var optionsGetStatusPages = {
method: 'GET', method: 'GET',
url: 'https://updown.io/api/status_pages?api-key=${{ secrets.UPDOWN_API_KEY }}', url: 'https://updown.io/api/status_pages?api-key=${{ secrets.UPDOWN_API_KEY }}'
json: true
}; };
request(optionsGetStatusPages, async function (error, response, body) { request(optionsGetStatusPages, async function (error, response, body) {
@ -86,11 +84,10 @@ jobs:
var optionsAddCheckToStatusPage = { var optionsAddCheckToStatusPage = {
method: 'PUT', method: 'PUT',
url: 'https://updown.io/api/status_pages/resvf?api-key=${{ secrets.UPDOWN_API_KEY }}', url: 'https://updown.io/api/status_pages/resvf?api-key=${{ secrets.UPDOWN_API_KEY }}',
json: true,
headers: { headers: {
'content-type': 'application/json' 'content-type': 'application/json'
}, },
body: JSON.stringify({checks: checksOfStatusPage}) json: {checks: checksOfStatusPage}
}; };
request(optionsAddCheckToStatusPage, async function (error, response, body) { request(optionsAddCheckToStatusPage, async function (error, response, body) {

View File

@ -54,7 +54,6 @@ jobs:
var request = require("request"); var request = require("request");
var options = { method: 'POST', var options = { method: 'POST',
url: 'https://api.uptimerobot.com/v2/newMonitor', url: 'https://api.uptimerobot.com/v2/newMonitor',
json:true,
headers: headers:
{ 'content-type': 'application/x-www-form-urlencoded', { 'content-type': 'application/x-www-form-urlencoded',
'cache-control': 'no-cache' }, 'cache-control': 'no-cache' },