@fxri/swagger2api 1.1.10 → 1.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
const { apiConfig, generateResponses, config } = it;
|
|
3
3
|
%>
|
|
4
4
|
|
|
5
|
-
import type { AxiosInstance, AxiosRequestConfig, HeadersDefaults, ResponseType, AxiosResponse } from "axios";
|
|
5
|
+
import type { AxiosInstance, AxiosRequestConfig, HeadersDefaults, ResponseType, AxiosResponse as AxiosResponseRaw } from "axios";
|
|
6
6
|
import axios from "axios";
|
|
7
7
|
|
|
8
8
|
export type QueryParamsType = Record<string | number, any>;
|
|
9
9
|
|
|
10
10
|
<% if (config.param?.extractResponseRaw) { %>
|
|
11
11
|
/** 提取响应 */
|
|
12
|
-
export interface
|
|
12
|
+
export interface AxiosResponse<T = any> {
|
|
13
13
|
/** 原始数据 */
|
|
14
|
-
raw:
|
|
14
|
+
raw: AxiosResponseRaw<T>;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
<% } %>
|
|
@@ -117,8 +117,6 @@ export class HttpClient<SecurityDataType = unknown> {
|
|
|
117
117
|
...params
|
|
118
118
|
<% if (config.unwrapResponseData) { %>
|
|
119
119
|
}: FullRequestParams): Promise<T> => {
|
|
120
|
-
<% } else if (config.param?.extractResponseRaw) { %>
|
|
121
|
-
}: FullRequestParams): Promise<AxiosResponseRaw<T>> => {
|
|
122
120
|
<% } else { %>
|
|
123
121
|
}: FullRequestParams): Promise<AxiosResponse<T>> => {
|
|
124
122
|
<% } %>
|
|
@@ -77,7 +77,7 @@ const describeReturnType = () => {
|
|
|
77
77
|
|
|
78
78
|
switch(config.httpClientType) {
|
|
79
79
|
case HTTP_CLIENT.AXIOS: {
|
|
80
|
-
return
|
|
80
|
+
return `Promise<AxiosResponse<${type}>>`
|
|
81
81
|
}
|
|
82
82
|
default: {
|
|
83
83
|
return `Promise<HttpResponse<${type}, ${errorType}>`
|