Skip to content

Commit e4310ef

Browse files
committed
fix deprication warning issue for parse
1 parent f6a2a72 commit e4310ef

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

packages/delivery-node/request.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
const http = require('http')
22
const https = require('https')
3-
// eslint-disable-next-line node/no-deprecated-api
4-
const { parse } = require('url')
3+
54

65
module.exports = ({ url, headers, body, agent }, cb) => {
76
let didError = false
@@ -11,14 +10,14 @@ module.exports = ({ url, headers, body, agent }, cb) => {
1110
cb(err)
1211
}
1312

14-
const parsedUrl = parse(url)
13+
const parsedUrl = new URL(url)
1514
const secure = parsedUrl.protocol === 'https:'
1615
const transport = secure ? https : http
1716
const req = transport.request({
1817
method: 'POST',
1918
hostname: parsedUrl.hostname,
2019
port: parsedUrl.port,
21-
path: parsedUrl.path,
20+
path: parsedUrl.pathname + parsedUrl.search,
2221
headers,
2322
agent
2423
})

0 commit comments

Comments
 (0)