refactor: remove deprecated url.parse() method (#7751)

This commit is contained in:
Corey
2022-01-06 09:26:00 -05:00
committed by GitHub
parent a43638f300
commit a5ffb95022
9 changed files with 74 additions and 36 deletions

View File

@@ -1,7 +1,6 @@
const Config = require('./Config');
const Auth = require('./Auth');
const RESTController = require('parse/lib/node/RESTController');
const URL = require('url');
const Parse = require('parse/node');
function getSessionToken(options) {
@@ -38,9 +37,9 @@ function ParseServerRESTController(applicationId, router) {
if (!config) {
config = Config.get(applicationId);
}
const serverURL = URL.parse(config.serverURL);
if (path.indexOf(serverURL.path) === 0) {
path = path.slice(serverURL.path.length, path.length);
const serverURL = new URL(config.serverURL);
if (path.indexOf(serverURL.pathname) === 0) {
path = path.slice(serverURL.pathname.length, path.length);
}
if (path[0] !== '/') {