File tree Expand file tree Collapse file tree 1 file changed +37
-7
lines changed Expand file tree Collapse file tree 1 file changed +37
-7
lines changed Original file line number Diff line number Diff line change @@ -9,14 +9,44 @@ import { type Uint8ArrayList } from 'uint8arraylist'
99
1010interface Fetch { ( req : Request ) : Promise < Response > }
1111
12- const METHOD_GET = 1
12+ const METHODS = [
13+ 'DELETE' ,
14+ 'GET' ,
15+ 'HEAD' ,
16+ 'POST' ,
17+ 'PUT' ,
18+ 'CONNECT' ,
19+ 'OPTIONS' ,
20+ 'TRACE' ,
21+ 'COPY' ,
22+ 'LOCK' ,
23+ 'MKCOL' ,
24+ 'MOVE' ,
25+ 'PROPFIND' ,
26+ 'PROPPATCH' ,
27+ 'SEARCH' ,
28+ 'UNLOCK' ,
29+ 'BIND' ,
30+ 'REBIND' ,
31+ 'UNBIND' ,
32+ 'ACL' ,
33+ 'REPORT' ,
34+ 'MKACTIVITY' ,
35+ 'CHECKOUT' ,
36+ 'MERGE' ,
37+ 'M-SEARCH' ,
38+ 'NOTIFY' ,
39+ 'SUBSCRIBE' ,
40+ 'UNSUBSCRIBE' ,
41+ 'PATCH' ,
42+ 'PURGE' ,
43+ 'MKCALENDAR' ,
44+ 'LINK' ,
45+ 'UNLINK'
46+ ]
1347
1448function getStringMethod ( method : number ) : string {
15- if ( method === 1 ) {
16- return 'GET'
17- }
18-
19- return 'UNKNOWN'
49+ return METHODS [ method ] ?? 'UNKNOWN'
2050}
2151
2252interface Duplex < TSource , TSink = TSource , RSink = Promise < void > > {
@@ -129,7 +159,7 @@ export function readHTTPMsg (expectRequest: boolean, r: Duplex<Uint8Array | Uint
129159 // Headers are parsed. We can return the response
130160 try {
131161 if ( expectRequest ) {
132- if ( info . method === METHOD_GET ) {
162+ if ( getStringMethod ( info . method ) === 'GET' ) {
133163 reqBody = null
134164 }
135165
You can’t perform that action at this time.
0 commit comments