Skip to content

Commit

Permalink
Fix node fetch issue and vulnerabilities (#55)
Browse files Browse the repository at this point in the history
* fix: change the function name because 'fetch' name could collide with window.fetch

* fix: remove vulnerabilities
  • Loading branch information
regiluze authored Jul 14, 2023
1 parent 6ca707c commit 92bae5e
Show file tree
Hide file tree
Showing 3 changed files with 929 additions and 837 deletions.
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*/

'use strict'
const fetch = require('node-fetch')
const nodeFetch = require('node-fetch')
const fs = require('fs')
const util = require('util')
const os = require('os')
Expand Down Expand Up @@ -537,7 +537,7 @@ Logsene.prototype.send = function (callback) {
}
self.logCount = Math.max(self.logCount - count, 0)
options = {...options, ...this.httpDefaults}
fetch(this.url, options)
nodeFetch(this.url, options)
.then(response => httpResult(null, response))
.catch(err => httpResult(err, null))
}
Expand Down Expand Up @@ -574,7 +574,7 @@ Logsene.prototype.shipFile = function (name, data, cb) {
self.emit('rt', { count: options.logCount, source: 'logsene', file: name, url: String(options.url), request: null, response: null })
}
}
fetch(options.url, options)
nodeFetch(options.url, options)
.then(response => callbackFunc(null, response))
.catch(error => callbackFunc(error, null))
}
Expand Down
Loading

0 comments on commit 92bae5e

Please sign in to comment.