Skip to content
This repository has been archived by the owner on Jun 27, 2024. It is now read-only.

Commit

Permalink
refactor(core): parse headers by default
Browse files Browse the repository at this point in the history
  • Loading branch information
boywithkeyboard committed Jun 21, 2023
1 parent b705044 commit 8fb452c
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions cheetah.ts
Original file line number Diff line number Diff line change
Expand Up @@ -412,24 +412,24 @@ export class cheetah<
let cookies: Record<string, string> = {}
let body

if (this.#validator && options) {
/* Parse Headers ------------------------------------------------------------ */
let num = 0

if (options.headers) {
let num = 0
for (const [key, value] of request.headers) {
if (num === 50) {
break
}

for (const [key, value] of request.headers) {
if (num === 50) {
break
}
if (!headers[key.toLowerCase()]) {
headers[key.toLowerCase()] = value
}

if (!headers[key.toLowerCase()]) {
headers[key.toLowerCase()] = value
}
num++
}

num++
}
if (this.#validator && options) {
/* Parse Headers ------------------------------------------------------------ */

if (options.headers) {
const isValid =
this.#validator.name === 'typebox' && this.#validator.check
? this.#validator.check(options.headers as TSchema, headers)
Expand Down

0 comments on commit 8fb452c

Please sign in to comment.