Skip to content

Commit

Permalink
refactor: use cuid2 package
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage committed Mar 10, 2023
1 parent f54dd8b commit a982fb6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
"@commitlint/cli": "^17.4.4",
"@commitlint/config-conventional": "^17.4.4",
"@fastify/middie": "^8.1.0",
"@japa/api-client": "^1.4.4",
"@japa/assert": "^1.4.1",
"@japa/expect-type": "^1.0.3",
"@japa/run-failed-tests": "^1.1.1",
Expand Down Expand Up @@ -95,6 +94,7 @@
"typescript": "^4.9.5"
},
"dependencies": {
"@paralleldrive/cuid2": "^2.2.0",
"@poppinss/macroable": "^1.0.0-2",
"@poppinss/matchit": "^3.1.2",
"@poppinss/middleware": "^3.1.0",
Expand All @@ -103,7 +103,6 @@
"accepts": "^1.3.8",
"content-disposition": "^0.5.4",
"cookie": "^0.5.0",
"cuid": "^3.0.0",
"destroy": "^1.2.0",
"encodeurl": "^1.0.2",
"etag": "^1.8.1",
Expand Down
4 changes: 2 additions & 2 deletions src/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
* file that was distributed with this source code.
*/

import cuid from 'cuid'
import fresh from 'fresh'
import typeIs from 'type-is'
import accepts from 'accepts'
Expand All @@ -17,6 +16,7 @@ import proxyaddr from 'proxy-addr'
import { safeEqual } from '@poppinss/utils'
import Macroable from '@poppinss/macroable'
import lodash from '@poppinss/utils/lodash'
import { createId } from '@paralleldrive/cuid2'
import { parse, UrlWithStringQuery } from 'node:url'
import type { Encryption } from '@adonisjs/encryption'
import { ServerResponse, IncomingMessage, IncomingHttpHeaders } from 'node:http'
Expand Down Expand Up @@ -154,7 +154,7 @@ export class Request extends Macroable {
id(): string | undefined {
let requestId = this.header('x-request-id')
if (!requestId && this.#config.generateRequestId) {
requestId = cuid()
requestId = createId()
this.request.headers['x-request-id'] = requestId
}

Expand Down

0 comments on commit a982fb6

Please sign in to comment.