mirror of
https://github.com/langgenius/dify.git
synced 2026-09-24 23:22:26 +08:00
chore: enable noUncheckedIndexedAccess (#35178)
This commit is contained in:
@@ -57,13 +57,13 @@ export const rewriteCookieHeaderForUpstream = (cookieHeader?: string) => {
|
||||
|
||||
const rewriteSetCookieValueForLocal = (setCookieValue: string) => {
|
||||
const [rawCookiePair, ...rawAttributes] = setCookieValue.split(';')
|
||||
const separatorIndex = rawCookiePair.indexOf('=')
|
||||
const separatorIndex = rawCookiePair!.indexOf('=')
|
||||
|
||||
if (separatorIndex === -1)
|
||||
return setCookieValue
|
||||
|
||||
const cookieName = rawCookiePair.slice(0, separatorIndex).trim()
|
||||
const cookieValue = rawCookiePair.slice(separatorIndex + 1)
|
||||
const cookieName = rawCookiePair!.slice(0, separatorIndex).trim()
|
||||
const cookieValue = rawCookiePair!.slice(separatorIndex + 1)
|
||||
const rewrittenAttributes = rawAttributes
|
||||
.map(attribute => attribute.trim())
|
||||
.filter(attribute =>
|
||||
|
||||
@@ -75,7 +75,7 @@ describe('dev proxy server', () => {
|
||||
}),
|
||||
)
|
||||
|
||||
const [, requestInit] = fetchImpl.mock.calls[0]
|
||||
const [, requestInit] = (fetchImpl.mock.calls[0] ?? []) as [unknown, any]
|
||||
const requestHeaders = requestInit?.headers as Headers
|
||||
expect(requestHeaders.get('cookie')).toBe('__Host-access_token=abc')
|
||||
expect(requestHeaders.get('origin')).toBe('https://cloud.dify.ai')
|
||||
|
||||
Reference in New Issue
Block a user