Skip to content
Myr

fix(request-id): validation accepts `=` (#4478)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by ryu · committed by GitHub · parent 253ec28 · Browse files · 2 files+14 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+14 added−1 removed

  • tests:+13 added−0 removed
  • other:+1 added−1 removed

2 files+14 added−1 removed

modified:src/middleware/request-id/index.test.ts+13 added
modified:src/middleware/request-id/request-id.ts+1 added-1 removed
44 unmodified lines
45}: RequestIdOptions = {}): MiddlewareHandler => {46 return async function requestId(c, next) {47 // If `headerName` is empty string, req.header will return the object48 let reqId = headerName ? c.req.header(headerName) : undefined49 if (!reqId || reqId.length > limitLength || /[^\w\-]/.test(reqId)) {49 if (!reqId || reqId.length > limitLength || /[^\w\-=]/.test(reqId)) {50 reqId = generator(c)51 }5253 c.set('requestId', reqId)
6 unmodified lines