File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -73,8 +73,13 @@ export class H3Event<
73
73
) ;
74
74
}
75
75
76
- get method ( ) : HTTPMethod | undefined {
77
- return this . _method || ( this . node . req . method as HTTPMethod ) ;
76
+ get method ( ) : HTTPMethod {
77
+ if ( ! this . _method ) {
78
+ this . _method = (
79
+ this . node . req . method || "GET"
80
+ ) . toUpperCase ( ) as HTTPMethod ;
81
+ }
82
+ return this . _method ;
78
83
}
79
84
80
85
get headers ( ) : Headers {
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ export async function proxyRequest(
38
38
// Request Body
39
39
let body ;
40
40
let duplex : Duplex | undefined ;
41
- if ( PayloadMethods . has ( event . method ! ) ) {
41
+ if ( PayloadMethods . has ( event . method ) ) {
42
42
if ( opts . streamRequest ) {
43
43
body = event . body ;
44
44
duplex = "half" ;
@@ -48,7 +48,7 @@ export async function proxyRequest(
48
48
}
49
49
50
50
// Method
51
- const method = opts . fetchOptions ?. method || event . method ! ;
51
+ const method = opts . fetchOptions ?. method || event . method ;
52
52
53
53
// Headers
54
54
const fetchHeaders = mergeHeaders (
You can’t perform that action at this time.
0 commit comments