Skip to content
Myr

feat(context): add Context-Type types to `c.header` (#3255)

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

* feat(context): add Context-Type types to `c.header` * chore: add JSDoc * chore: format code * use strict mimetype types and change HeaderRecord

authored by Shotaro Nakamura · committed by GitHub · parent 8ba0227 · Browse files · 2 files+68 added−4 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+68 added−4 removed

  • other:+68 added−4 removed

2 files+68 added−4 removed

modified:src/utils/mime.ts+60 added-2 removed
modified:src/context.ts+8 added-2 removed
16 unmodified lines
17 JSONParsed,18 JSONValue,19 SimplifyDeepArray,20} from './utils/types'21import type { BaseMime } from './utils/mime'2222type HeaderRecord = Record<ResponseHeader, string | string[]> | Record<string, string | string[]>23type HeaderRecord =24 | Record<'Content-Type', BaseMime>25 | Record<ResponseHeader, string | string[]>26 | Record<string, string | string[]>2728/**29 * Data type can be a string, ArrayBuffer, or ReadableStream.30 */
276 unmodified lines
307 | 'X-Robots-Tag'308 | 'X-XSS-Protection'309310interface SetHeaders {311 (name: 'Content-Type', value?: BaseMime, options?: SetHeadersOptions): void312 (name: ResponseHeader, value?: string, options?: SetHeadersOptions): void313 (name: string, value?: string, options?: SetHeadersOptions): void314}315316type ResponseHeadersInit =317 | [string, string][]313 | Record<string, string>318 | Record<'Content-Type', BaseMime>319 | Record<ResponseHeader, string>320 | Record<string, string>321 | Headers322323interface ResponseInit {324 headers?: ResponseHeadersInit
582 unmodified lines