mirror of https://github.com/certd/certd
chore: 代理初步
parent
d5956072f0
commit
830de90317
|
@ -1,7 +1,7 @@
|
||||||
import axios, { AxiosRequestConfig } from "axios";
|
import axios, { AxiosRequestConfig } from "axios";
|
||||||
import { logger } from "./util.log.js";
|
import { logger } from "./util.log.js";
|
||||||
import { Logger } from "log4js";
|
import { Logger } from "log4js";
|
||||||
import { ProxyAgent } from "proxy-agent";
|
import { ProxyAgent, ProxyAgentOptions } from "proxy-agent";
|
||||||
export class HttpError extends Error {
|
export class HttpError extends Error {
|
||||||
status?: number;
|
status?: number;
|
||||||
statusText?: string;
|
statusText?: string;
|
||||||
|
@ -136,7 +136,7 @@ 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>>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export function createAgent(opts: any = {}) {
|
export function createAgent(opts: ProxyAgentOptions = {}) {
|
||||||
const httpAgent = new ProxyAgent(opts);
|
const httpAgent = new ProxyAgent(opts);
|
||||||
return {
|
return {
|
||||||
httpAgent,
|
httpAgent,
|
||||||
|
|
Loading…
Reference in New Issue