@@ -95,6 +95,7 @@ interface EndpointLayoutContext {
9595 method : Method
9696 hasOptions : boolean
9797 responseKey : string
98+ methodParamName : 'params' | 'body'
9899 requestFormat : 'params' | 'body'
99100 requestTypeName : string
100101 responseTypeName : string
@@ -155,8 +156,14 @@ const getEndpointLayoutContext = (
155156) : EndpointLayoutContext => {
156157 const prefix = pascalCase ( [ route . path . split ( '/' ) , endpoint . name ] . join ( '_' ) )
157158
158- const requestFormat = getRequestFormat ( endpoint . name , route . name )
159- const requestFormatSuffix = pascalCase ( requestFormat )
159+ const methodParamName = getMethodParamName ( endpoint . name , route . name )
160+ const requestFormatSuffix = pascalCase ( methodParamName )
161+
162+ const requestFormat = [ 'GET' , 'DELETE' ] . includes (
163+ endpoint . request . preferredMethod ,
164+ )
165+ ? 'params'
166+ : 'body'
160167
161168 const returnsActionAttempt =
162169 endpoint . response . responseType === 'resource' &&
@@ -167,6 +174,7 @@ const getEndpointLayoutContext = (
167174 methodName : camelCase ( endpoint . name ) ,
168175 method : endpoint . request . preferredMethod ,
169176 hasOptions : returnsActionAttempt ,
177+ methodParamName,
170178 requestFormat,
171179 requestFormatSuffix,
172180 returnsActionAttempt,
@@ -195,7 +203,7 @@ const getResponseContext = (
195203 }
196204}
197205
198- const getRequestFormat = (
206+ const getMethodParamName = (
199207 endpointName : string ,
200208 routeName : string ,
201209) : 'params' | 'body' => {
0 commit comments