qiwi/qorsproxy

View on GitHub
src/main/js/servlet/corsproxy/url.js

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
import url from 'node:url'

/**
 *
 * @param {Object} req
 * @returns {Object}
 */
url.parseRequest = (req) => {
  let path = req.url.slice(1)
  path = /^https?:/.test(path) ? path : req.protocol + '://' + path

  return url.parse(path) // eslint-disable-line
}


export {default} from 'node:url'