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

Commit

Permalink
fix: respect type of headers schema (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
boywithkeyboard authored Jul 20, 2023
1 parent a4e726d commit e7cc6d1
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions request_context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,12 @@ export class RequestContext<
/**
* The validated headers of the incoming request.
*/
get headers(): ValidatedHeaders extends unknown
? Record<string, string | undefined>
: Static<ValidatedHeaders> {
get headers(): ValidatedHeaders extends ObjectType ? Static<ValidatedHeaders>
: Record<string, string | undefined> {
if (this.#h) {
return this.#h as ValidatedHeaders extends unknown
? Record<string, string | undefined>
: Static<ValidatedHeaders>
return this.#h as ValidatedHeaders extends ObjectType
? Static<ValidatedHeaders>
: Record<string, string | undefined>
}

this.#h = {}
Expand All @@ -207,9 +206,9 @@ export class RequestContext<
}
}

return this.#h as ValidatedHeaders extends unknown
? Record<string, string | undefined>
: Static<ValidatedHeaders>
return this.#h as ValidatedHeaders extends ObjectType
? Static<ValidatedHeaders>
: Record<string, string | undefined>
}

/**
Expand Down

0 comments on commit e7cc6d1

Please sign in to comment.