Skip to content

Commit

Permalink
Remove UUID dependency
Browse files Browse the repository at this point in the history
This dependency was removed from HMPPS Typescript template so this commit brings this codebase inline with the template.

See ministryofjustice/hmpps-template-typescript#439
  • Loading branch information
aliuk2012 committed Dec 31, 2024
1 parent 3304f9a commit 4cb0512
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 28 deletions.
24 changes: 1 addition & 23 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,7 @@
"static-path": "^0.0.4",
"superagent": "^9.0.0",
"underscore": "^1.13.6",
"url-value-parser": "^2.2.0",
"uuid": "^10.0.0"
"url-value-parser": "^2.2.0"
},
"devDependencies": {
"@golevelup/ts-jest": "^0.5.0",
Expand All @@ -187,7 +186,6 @@
"@types/superagent": "^8.0.0",
"@types/supertest": "^6.0.0",
"@types/underscore": "^1.11.4",
"@types/uuid": "^10.0.0",
"@typescript-eslint/eslint-plugin": "^7.0.0",
"@typescript-eslint/parser": "^7.0.0",
"audit-ci": "^7.0.0",
Expand Down
3 changes: 1 addition & 2 deletions server/middleware/setUpWebSession.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { v4 as uuidv4 } from 'uuid'
import session from 'express-session'
import RedisStore from 'connect-redis'
import express, { Router } from 'express'
Expand Down Expand Up @@ -32,7 +31,7 @@ export default function setUpWebSession(): Router {
router.use((req, res, next) => {
const headerName = 'X-Request-Id'
const oldValue = req.get(headerName)
const id = oldValue === undefined ? uuidv4() : oldValue
const id = oldValue === undefined ? crypto.randomUUID() : oldValue

res.set(headerName, id)
req.id = id
Expand Down

0 comments on commit 4cb0512

Please sign in to comment.