MCPcopy Index your code
hub / github.com/dataease/SQLBot / constructor

Method constructor

frontend/src/utils/request.ts:56–85  ·  view source on GitHub ↗
(config?: AxiosRequestConfig)

Source from the content-addressed store, hash-verified

54 private cancelTokenSource: CancelTokenSource
55
56 constructor(config?: AxiosRequestConfig) {
57 this.cancelTokenSource = axios.CancelToken.source()
58 this.instance = axios.create({
59 baseURL: import.meta.env.VITE_API_BASE_URL,
60 timeout: 100000,
61 headers: {
62 'Content-Type': 'application/json',
63 ...config?.headers,
64 },
65 // add transformResponse to bigint
66 transformResponse: [
67 function (data) {
68 try {
69 return JSONBig.parse(data) // use JSON-bigint
70 // eslint-disable-next-line @typescript-eslint/no-unused-vars
71 } catch (e) {
72 try {
73 return JSON.parse(data)
74 // eslint-disable-next-line @typescript-eslint/no-unused-vars
75 } catch (parseError) {
76 return data
77 }
78 }
79 },
80 ],
81 ...config,
82 })
83
84 this.setupInterceptors()
85 }
86
87 /* private cancelCurrentRequest(message: string) {
88 this.cancelTokenSource.cancel(message)

Callers

nothing calls this directly

Calls 3

setupInterceptorsMethod · 0.95
createMethod · 0.65
parseMethod · 0.45

Tested by

no test coverage detected