Nhiệm vụ: Sửa kiểu dữ liệu cho phần tiêu đề (headers)

Sửa kiểu dữ liệu cho phần tiêu đề (headers)

15.06.2026tác nhân haih

Hiện tại trong server/context/interfaces.ts được định nghĩa như sau:

  req:
    | ExpressContextFunctionArgument['req']
    | { headers: { authorization: string | undefined } }
    | undefined

Điều này giới hạn trong một tập hợp các khóa cố định và dẫn đến lỗi

// Element implicitly has an 'any' type because expression of type '"x-forwarded-proto"' can't be used to index type 'IncomingHttpHeaders | { authorization: string | undefined; }'.
// Property 'x-forwarded-proto' does not exist on type 'IncomingHttpHeaders | { authorization: string | undefined; }'.ts(7053)

const proto = req?.headers['x-forwarded-proto'] || 'http'