@defra/lis-hubs-infra-access 0.26.0-lreg-563.alpha.2 → 0.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defra/lis-hubs-infra-access",
3
- "version": "0.26.0-lreg-563.alpha.2",
3
+ "version": "0.26.0",
4
4
  "description": "Shared hub access and capability resolution for the livestock platform.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -54,8 +54,10 @@ export function getReturnUrlFromRequest(request) {
54
54
  * @returns {URL}
55
55
  */
56
56
  export function buildCurrentRequestUrl(request, port) {
57
- const protocol = String(request.headers['x-forwarded-proto'] ?? 'http')
58
- const host = String(request.headers.host ?? `localhost:${port}`)
57
+ const forwardedProto = request.headers['x-forwarded-proto']
58
+ const protocol = typeof forwardedProto === 'string' ? forwardedProto : 'http'
59
+ const hostHeader = request.headers.host
60
+ const host = typeof hostHeader === 'string' ? hostHeader : `localhost:${port}`
59
61
  const currentUrl = new URL(
60
62
  request.raw.req.url ?? request.path,
61
63
  `${protocol}://${host}`