-
Notifications
You must be signed in to change notification settings - Fork 255
Open
Description
Hi,
request is deprecated. One way to replace it could be to use node-fetch:
--- a/lib/sendToCoveralls.js
+++ b/lib/sendToCoveralls.js
@@ -1,6 +1,6 @@
'use strict';
-const request = require('request');
+const fetch = require('node-fetch');
const index = require('..');
const sendToCoveralls = (obj, cb) => {
@@ -16,13 +16,14 @@
process.stdout.write(str);
cb(null, { statusCode: 200 }, '');
} else {
- request.post({
- url,
- form: {
- json: str
- }
- }, (err, response, body) => {
- cb(err, response, body);
+ fetch(url, {
+ method: "post",
+ body: str,
+ headers: { 'Content-Type': 'application/json' },
+ }).then(res => {
+ cb(null, res, res.body);
+ }).catch(err => {
+ cb(err);
});
}
};Of course, test must be updated also
Elinia, killmenot, fvdm, jimmywarting, bcomnes and 2 more
Metadata
Metadata
Assignees
Labels
No labels