Skip to content

Commit e6e5f21

Browse files
committed
fix: update Axios method generation to merge query parameters
This commit modifies the Axios method generation to ensure that query parameters are merged correctly into the axiosConfig object. The change enhances the handling of query parameters by combining existing parameters with new queryData, improving the overall functionality of the generated API client methods.
1 parent 394d4f0 commit e6e5f21

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/generator/clientGenerator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ function generateAxiosMethod(operation: OperationInfo, spec: OpenAPIV3.Document)
132132
})
133133
.join("\n ")}`
134134
: "",
135-
queryParams.length > 0 ? "axiosConfig.params = queryData;" : "",
135+
queryParams.length > 0 ? "axiosConfig.params = { ...axiosConfig.params, ...queryData };" : "",
136136
isFormData
137137
? "axiosConfig.headers = { ...axiosConfig.headers, 'Content-Type': 'multipart/form-data' };"
138138
: "",

0 commit comments

Comments
 (0)