Skip to content

Commit 153e527

Browse files
authored
Update parse_headers.ts
1 parent 6a56646 commit 153e527

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

src/http/parse_headers.ts

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,28 @@
1+
type Keys =
2+
| "accept"
3+
| "accept-encoding"
4+
| "accept-language"
5+
| "connection"
6+
| "host"
7+
| "referer"
8+
| "sec-ch-ua"
9+
| "sec-ch-ua-mobile"
10+
| "sec-ch-ua-platform"
11+
| "sec-fetch-dest"
12+
| "sec-fetch-mode"
13+
| "sec-fetch-site"
14+
| "user-agent"
15+
// deno-lint-ignore ban-types
16+
| (string & {})
17+
118
/**
219
* This function parses a Headers object and returns it as a parsed object.
320
*
421
* @param headers Header that should get parsed
522
* @returns The parsed header
623
*/
7-
export default function parseHeaders(headers : Headers) : Record<string, string> {
8-
const header : Record<string, string> = {};
24+
export default function parseHeaders(headers : Headers) : Record<Keys, string> {
25+
const header : Record<Keys | string, string> = {};
926
for(const [key, value] of headers.entries()) {
1027
header[key] = value;
1128
};

0 commit comments

Comments
 (0)