@@ -263,16 +263,18 @@ export class Printer {
263263 private _printOperation ( method : string , url : string , operation : OpenApiLatest_Operation ) {
264264 if ( isRefOperation ( operation ) ) return ;
265265
266+ const { responseStatusCode, responseContentType, requestContentType, axiosRequestConfigTypeName = AXIOS_QUEST_CONFIG_TYPE_NAME } = this . options || { } ;
266267 const argNamed = new Named ( ) ;
267268 const header = new Arg ( argNamed , 'headers' , this . schemata ) ;
268269 const cookie = new Arg ( argNamed , 'cookies' , this . schemata ) ;
269270 const query = new Arg ( argNamed , 'params' , this . schemata ) ;
270271 const path = new Arg ( argNamed , 'path' , this . schemata ) ;
272+ path . setUrl ( url ) ; // 设置 url,用于解析 path 参数
271273 const data = new Arg ( argNamed , 'data' , this . schemata , true ) ;
272274 const config = new Arg ( argNamed , 'config' , this . schemata , true ) ;
275+ config . setDefaultType ( axiosRequestConfigTypeName ) ;
273276 const resp = new Arg ( argNamed , 'response' , this . schemata , true ) ;
274277 const { parameters, requestBody, responses, operationId } = operation ;
275- const { responseStatusCode, responseContentType, requestContentType } = this . options || { } ;
276278
277279 if ( parameters ) {
278280 parameters . forEach ( ( parameter ) => {
@@ -342,13 +344,12 @@ export class Printer {
342344 jsDoc . addComments ( comments ) ;
343345 jsDoc . addComments ( requestArgs . toComments ( ) ) ;
344346 jsDoc . addComments ( responseArgs . toComments ( ) ) ;
345- const { axiosRequestConfigTypeName = AXIOS_QUEST_CONFIG_TYPE_NAME } = this . options || { } ;
346347
347348 return `${ jsDoc . print ( ) }
348- export async function ${ funcName } (${ requestArgs . toArgs ( axiosRequestConfigTypeName ) } ): AxiosPromise<${ respType } > {
349+ export async function ${ funcName } (${ requestArgs . toArgs ( ) } ): AxiosPromise<${ respType } > {
349350 return axios({
350351 method: ${ JSON . stringify ( method ) } ,
351- ${ requestArgs . toValues ( url ) }
352+ ${ requestArgs . toValues ( ) }
352353 });
353354}` ;
354355 }
0 commit comments