@@ -33,8 +33,6 @@ import type {
33
33
Submission ,
34
34
SuccessResult ,
35
35
UIMatch ,
36
- V7_FormMethod ,
37
- V7_MutationFormMethod ,
38
36
AgnosticPatchRoutesOnMissFunction ,
39
37
} from "./utils" ;
40
38
import {
@@ -367,7 +365,6 @@ export type HydrationState = Partial<
367
365
*/
368
366
export interface FutureConfig {
369
367
v7_fetcherPersist : boolean ;
370
- v7_normalizeFormMethod : boolean ;
371
368
v7_partialHydration : boolean ;
372
369
v7_prependBasename : boolean ;
373
370
unstable_skipActionErrorRevalidation : boolean ;
@@ -735,17 +732,17 @@ interface RevalidatingFetcher extends FetchLoadMatch {
735
732
}
736
733
737
734
const validMutationMethodsArr : MutationFormMethod [ ] = [
738
- "post " ,
739
- "put " ,
740
- "patch " ,
741
- "delete " ,
735
+ "POST " ,
736
+ "PUT " ,
737
+ "PATCH " ,
738
+ "DELETE " ,
742
739
] ;
743
740
const validMutationMethods = new Set < MutationFormMethod > (
744
741
validMutationMethodsArr
745
742
) ;
746
743
747
744
const validRequestMethodsArr : FormMethod [ ] = [
748
- "get " ,
745
+ "GET " ,
749
746
...validMutationMethodsArr ,
750
747
] ;
751
748
const validRequestMethods = new Set < FormMethod > ( validRequestMethodsArr ) ;
@@ -845,7 +842,6 @@ export function createRouter(init: RouterInit): Router {
845
842
// Config driven behavior flags
846
843
let future : FutureConfig = {
847
844
v7_fetcherPersist : false ,
848
- v7_normalizeFormMethod : false ,
849
845
v7_partialHydration : false ,
850
846
v7_prependBasename : false ,
851
847
unstable_skipActionErrorRevalidation : false ,
@@ -1373,7 +1369,6 @@ export function createRouter(init: RouterInit): Router {
1373
1369
opts ?. relative
1374
1370
) ;
1375
1371
let { path, submission, error } = normalizeNavigateOptions (
1376
- future . v7_normalizeFormMethod ,
1377
1372
false ,
1378
1373
normalizedPath ,
1379
1374
opts
@@ -2180,7 +2175,6 @@ export function createRouter(init: RouterInit): Router {
2180
2175
}
2181
2176
2182
2177
let { path, submission, error } = normalizeNavigateOptions (
2183
- future . v7_normalizeFormMethod ,
2184
2178
true ,
2185
2179
normalizedPath ,
2186
2180
opts
@@ -3668,7 +3662,7 @@ export function createStaticHandler(
3668
3662
) ;
3669
3663
3670
3664
try {
3671
- if ( isMutationMethod ( request . method . toLowerCase ( ) ) ) {
3665
+ if ( isMutationMethod ( request . method ) ) {
3672
3666
let result = await submit (
3673
3667
request ,
3674
3668
matches ,
@@ -4140,7 +4134,6 @@ function normalizeTo(
4140
4134
// Normalize navigation options by converting formMethod=GET formData objects to
4141
4135
// URLSearchParams so they behave identically to links with query params
4142
4136
function normalizeNavigateOptions (
4143
- normalizeFormMethod : boolean ,
4144
4137
isFetcher : boolean ,
4145
4138
path : string ,
4146
4139
opts ?: BaseNavigateOrFetchOptions
@@ -4168,9 +4161,7 @@ function normalizeNavigateOptions(
4168
4161
4169
4162
// Create a Submission on non-GET navigations
4170
4163
let rawFormMethod = opts . formMethod || "get" ;
4171
- let formMethod = normalizeFormMethod
4172
- ? ( rawFormMethod . toUpperCase ( ) as V7_FormMethod )
4173
- : ( rawFormMethod . toLowerCase ( ) as FormMethod ) ;
4164
+ let formMethod = rawFormMethod . toUpperCase ( ) as FormMethod ;
4174
4165
let formAction = stripHashFromPath ( path ) ;
4175
4166
4176
4167
if ( opts . body !== undefined ) {
@@ -5501,14 +5492,12 @@ function isRedirectResponse(result: any): result is Response {
5501
5492
return status >= 300 && status <= 399 && location != null ;
5502
5493
}
5503
5494
5504
- function isValidMethod ( method : string ) : method is FormMethod | V7_FormMethod {
5505
- return validRequestMethods . has ( method . toLowerCase ( ) as FormMethod ) ;
5495
+ function isValidMethod ( method : string ) : method is FormMethod {
5496
+ return validRequestMethods . has ( method . toUpperCase ( ) as FormMethod ) ;
5506
5497
}
5507
5498
5508
- function isMutationMethod (
5509
- method : string
5510
- ) : method is MutationFormMethod | V7_MutationFormMethod {
5511
- return validMutationMethods . has ( method . toLowerCase ( ) as MutationFormMethod ) ;
5499
+ function isMutationMethod ( method : string ) : method is MutationFormMethod {
5500
+ return validMutationMethods . has ( method . toUpperCase ( ) as MutationFormMethod ) ;
5512
5501
}
5513
5502
5514
5503
async function resolveDeferredResults (
0 commit comments