moving to node-fetch coz axios is causing issues with scrapingAnt

This commit is contained in:
weakmap@gmail.com
2022-12-20 10:21:15 +01:00
parent 60bb75da57
commit 8a5fbcdf71
6 changed files with 59 additions and 39 deletions

View File

@@ -1,6 +1,6 @@
const { markdown2Html } = require('../../services/markdown');
const { getJob } = require('../../services/storage/jobStorage');
const axios = require('axios');
const fetch = require('node-fetch');
/**
* sends new listings to mattermost
@@ -21,9 +21,13 @@ exports.send = ({ serviceName, newListings, notificationConfig, jobKey }) => {
(o) => `| [${o.title}](${o.link}) | ` + [o.address, o.size.replace(/2m/g, '$m^2$'), o.price].join(' | ') + ' |\n'
);
return axios.post(`${webhook}`, {
channel: channel,
text: message,
return fetch(webhook, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: {
channel: channel,
text: message,
},
});
};