@podium/utils
Advanced tools
Comparing version 5.0.0-next.8 to 5.0.0-next.9
@@ -0,1 +1,8 @@ | ||
# [5.0.0-next.9](https://github.com/podium-lib/utils/compare/v5.0.0-next.8...v5.0.0-next.9) (2022-10-09) | ||
### Bug Fixes | ||
* Remove original url module ([#185](https://github.com/podium-lib/utils/issues/185)) ([6c01c0f](https://github.com/podium-lib/utils/commit/6c01c0f44e3b24c7f481a2504003903529e8f80e)) | ||
# [5.0.0-next.8](https://github.com/podium-lib/utils/compare/v5.0.0-next.7...v5.0.0-next.8) (2022-05-04) | ||
@@ -2,0 +9,0 @@ |
@@ -1,3 +0,2 @@ | ||
import originalUrl from 'original-url'; | ||
import { URL } from 'url'; | ||
import { URL } from 'node:url'; | ||
@@ -7,8 +6,6 @@ const inspect = Symbol.for('nodejs.util.inspect.custom'); | ||
const urlFromRequest = request => { | ||
try { | ||
const url = originalUrl(request); | ||
return new URL(url.raw, `${url.protocol}//${request.headers.host}`); | ||
} catch (err) { | ||
return {}; | ||
} | ||
const protocol = request?.protocol || 'http'; | ||
const host = request?.headers?.host || 'localhost'; | ||
const url = request?.url || ''; | ||
return new URL(url, `${protocol.replace(/:/, '')}://${host}`); | ||
}; | ||
@@ -29,3 +26,2 @@ | ||
constructor(request = {}, response = {}, params = {}) { | ||
const url = urlFromRequest(request); | ||
this.#development = false; | ||
@@ -39,3 +35,3 @@ this.#response = response; | ||
this.#view = {}; | ||
this.#url = url; | ||
this.#url = undefined; | ||
this.#css = []; | ||
@@ -135,7 +131,8 @@ this.#js = []; | ||
set url(value) { | ||
this.#url = value; | ||
this.#url = new URL(value); | ||
} | ||
get url() { | ||
return this.#url; | ||
if (this.#url) return this.#url; | ||
return urlFromRequest(this.#request);; | ||
} | ||
@@ -197,2 +194,1 @@ | ||
}; | ||
// export default HttpIncoming; |
{ | ||
"name": "@podium/utils", | ||
"version": "5.0.0-next.8", | ||
"version": "5.0.0-next.9", | ||
"description": "Common generic utility methods shared by @podium modules.", | ||
@@ -41,7 +41,3 @@ "type": "module", | ||
"@semantic-release/changelog": "6.0.1", | ||
"@semantic-release/commit-analyzer": "9.0.2", | ||
"@semantic-release/git": "10.0.1", | ||
"@semantic-release/github": "8.0.4", | ||
"@semantic-release/npm": "9.0.1", | ||
"@semantic-release/release-notes-generator": "10.0.3", | ||
"benchmark": "2.1.4", | ||
@@ -59,5 +55,4 @@ "eslint": "8.14.0", | ||
"dependencies": { | ||
"camelcase": "6.3.0", | ||
"original-url": "1.2.3" | ||
"camelcase": "6.3.0" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
57404
1
12
855
- Removedoriginal-url@1.2.3
- Removedforwarded-parse@2.1.2(transitive)
- Removedoriginal-url@1.2.3(transitive)