mirror of https://github.com/certd/certd
chore:
parent
023f2d4569
commit
ccdc933064
|
@ -145,7 +145,7 @@ export function createAxiosService({ logger }: { logger: Logger }) {
|
||||||
} else {
|
} else {
|
||||||
logger.info("http response status:", response?.status);
|
logger.info("http response status:", response?.status);
|
||||||
}
|
}
|
||||||
if (response?.config?.returnResponse) {
|
if (response?.config?.returnOriginRes) {
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
return response.data;
|
return response.data;
|
||||||
|
@ -215,7 +215,7 @@ export type HttpRequestConfig<D = any> = {
|
||||||
logParams?: boolean;
|
logParams?: boolean;
|
||||||
logRes?: boolean;
|
logRes?: boolean;
|
||||||
httpProxy?: string;
|
httpProxy?: string;
|
||||||
returnResponse?: boolean;
|
returnOriginRes?: boolean;
|
||||||
} & AxiosRequestConfig<D>;
|
} & AxiosRequestConfig<D>;
|
||||||
export type HttpClient = {
|
export type HttpClient = {
|
||||||
request<D = any, R = any>(config: HttpRequestConfig<D>): Promise<HttpClientResponse<R>>;
|
request<D = any, R = any>(config: HttpRequestConfig<D>): Promise<HttpClientResponse<R>>;
|
||||||
|
|
|
@ -36,7 +36,7 @@ function createService() {
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
if (response.config.returnResponse) {
|
if (response.config.returnOriginRes) {
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
// dataAxios 是 axios 返回数据中的 data
|
// dataAxios 是 axios 返回数据中的 data
|
||||||
|
|
|
@ -58,7 +58,7 @@ export class Dns51Client {
|
||||||
method: "get",
|
method: "get",
|
||||||
withCredentials: true,
|
withCredentials: true,
|
||||||
logRes: false,
|
logRes: false,
|
||||||
returnResponse: true,
|
returnOriginRes: true,
|
||||||
headers: {
|
headers: {
|
||||||
// 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.6261.95 Safari/537.36',
|
// 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.6261.95 Safari/537.36',
|
||||||
'Origin': 'https://www.51dns.com',
|
'Origin': 'https://www.51dns.com',
|
||||||
|
@ -90,7 +90,7 @@ export class Dns51Client {
|
||||||
},
|
},
|
||||||
withCredentials: true,
|
withCredentials: true,
|
||||||
logRes: false,
|
logRes: false,
|
||||||
returnResponse: true,
|
returnOriginRes: true,
|
||||||
headers: {
|
headers: {
|
||||||
'Origin': 'https://www.51dns.com',
|
'Origin': 'https://www.51dns.com',
|
||||||
'Referer': 'https://www.51dns.com',
|
'Referer': 'https://www.51dns.com',
|
||||||
|
@ -117,7 +117,7 @@ export class Dns51Client {
|
||||||
method: 'get',
|
method: 'get',
|
||||||
withCredentials: true,
|
withCredentials: true,
|
||||||
logRes: false,
|
logRes: false,
|
||||||
returnResponse: true,
|
returnOriginRes: true,
|
||||||
headers: {
|
headers: {
|
||||||
// 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.6261.95 Safari/537.36',
|
// 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.6261.95 Safari/537.36',
|
||||||
'Origin': 'https://www.51dns.com',
|
'Origin': 'https://www.51dns.com',
|
||||||
|
@ -144,7 +144,7 @@ export class Dns51Client {
|
||||||
method: "get",
|
method: "get",
|
||||||
withCredentials: true,
|
withCredentials: true,
|
||||||
logRes: false,
|
logRes: false,
|
||||||
returnResponse: true,
|
returnOriginRes: true,
|
||||||
headers: this.getRequestHeaders()
|
headers: this.getRequestHeaders()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ export class UpyunClient {
|
||||||
password: access.password
|
password: access.password
|
||||||
},
|
},
|
||||||
logRes: false,
|
logRes: false,
|
||||||
returnResponse: true
|
returnOriginRes: true
|
||||||
});
|
});
|
||||||
if (res.data?.errors?.length > 0) {
|
if (res.data?.errors?.length > 0) {
|
||||||
throw new Error(JSON.stringify(res.data.msg));
|
throw new Error(JSON.stringify(res.data.msg));
|
||||||
|
|
Loading…
Reference in New Issue