Skip to content

Commit

Permalink
fix: replace deprecated url.parse() with new url.URL()
Browse files Browse the repository at this point in the history
Signed-off-by: naseemkullah <[email protected]>
  • Loading branch information
naseemkullah committed Jan 25, 2021
1 parent 6757653 commit 785ed66
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ export class PrometheusExporter implements MetricExporter {
).replace(/^([^/])/, '/$1');

if (config.preventServerStart !== true) {
this.startServer().then(callback).catch(err => this._logger.error(err));
this.startServer()
.then(callback)
.catch(err => this._logger.error(err));
} else if (callback) {
callback();
}
Expand Down Expand Up @@ -176,7 +178,7 @@ export class PrometheusExporter implements MetricExporter {
request: IncomingMessage,
response: ServerResponse
) => {
if (url.parse(request.url!).pathname === this._endpoint) {
if (request.url && new url.URL(request.url).pathname === this._endpoint) {
this._exportMetrics(response);
} else {
this._notFound(response);
Expand Down

0 comments on commit 785ed66

Please sign in to comment.