Skip to content

Commit

Permalink
Use new URL instead of url.parse
Browse files Browse the repository at this point in the history
  • Loading branch information
harryadel authored and auvipy committed Oct 8, 2023
1 parent 0b2eefe commit 2ba9713
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/support/sockjs_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
var http = require('http');
var serveStatic = require('serve-static');
var sockjs = require('./sockjs_app');
var url = require('url');
var URL = require('url').URL;
var path = require('path');
var debug = require('debug')('sockjs-client:test-server:main');

Expand Down Expand Up @@ -44,7 +44,7 @@ function startServer(port, config, prefix) {
res.end(new Array(2049).join('a') + '\nb\n');
} else if (req.url === '/config.js') {
if (req.headers.referer) {
var parsedOrigin = url.parse(req.headers.referer);
var parsedOrigin = new URL(req.headers.referer);
clientOptions.url = parsedOrigin.protocol + '//' + parsedOrigin.hostname + ':' + config.port;
}
res.setHeader('content-type', 'application/javascript');
Expand Down

0 comments on commit 2ba9713

Please sign in to comment.