Fix errornous headers field inoptions
Signed-off-by: Fred Boniface <fred@fjla.uk>
This commit is contained in:
parent
a87f203782
commit
be9fb68c3d
@ -1,4 +1,3 @@
|
|||||||
/* eslint-disable no-useless-escape */
|
|
||||||
//const axios = require("axios");
|
//const axios = require("axios");
|
||||||
import { logger } from "../utils/logger.utils";
|
import { logger } from "../utils/logger.utils";
|
||||||
|
|
||||||
@ -20,25 +19,29 @@ async function processor(data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function sendToGitea(body) {
|
async function sendToGitea(body) {
|
||||||
let key = process.env.OWL_GIT_ISSUEBOT;
|
try {
|
||||||
let url = process.env.OWL_GIT_APIENDPOINT;
|
const key = process.env.OWL_GIT_ISSUEBOT;
|
||||||
let opts = {
|
const url = process.env.OWL_GIT_APIENDPOINT;
|
||||||
method: "POST",
|
const opts = {
|
||||||
headers: {
|
method: "POST",
|
||||||
Authorization: key,
|
headers: {
|
||||||
},
|
Authorization: key,
|
||||||
body: body,
|
},
|
||||||
};
|
body: body,
|
||||||
//var res = await axios.post(url, body, opts);
|
};
|
||||||
const res = await fetch(url, opts);
|
|
||||||
/* Need to read the output from the POST and pass the result upwards to the
|
const res = await fetch(url, opts);
|
||||||
client.*/
|
|
||||||
if (res.status == 201) {
|
if (res.status === 201) {
|
||||||
logger.info("issueService.sendToGitea: Issue sent to Gitea");
|
logger.debug("issueService.sendToGitea: Issue created");
|
||||||
return { status: res.status, message: "issue created" };
|
return {status: res.status, message: "issue created"};
|
||||||
} else {
|
} else {
|
||||||
logger.error(res.body, "issueService.sendToGitea: Fail to send issue");
|
logger.error(`issueService.sendtoGitea: Error creating issue RETURN: ${res.status}`);
|
||||||
return { status: res.status, message: "issue not created" };
|
return {status: res.status, message: "issue not created"};
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
logger.error(err, `issueService.sendToGitea`);
|
||||||
|
return {status:500, message: "Internal Server Error"};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user