@@ -128,8 +128,13 @@ function loaderCommonConfig(
128
128
}
129
129
130
130
// 1.3.porxy
131
- if ( isUndefined ( proxy ) && ! isUndefined ( baseConfig . proxy ) ) {
132
- proxy = baseConfig . proxy
131
+ // requestConfig > loaderConfig > baseConfig
132
+ if ( isUndefined ( proxy ) ) {
133
+ if ( ! isUndefined ( loaderConfig . proxy ) ) {
134
+ proxy = loaderConfig . proxy
135
+ } else if ( ! isUndefined ( baseConfig . proxy ) ) {
136
+ proxy = baseConfig . proxy
137
+ }
133
138
}
134
139
135
140
// 1.4.maxRetry
@@ -169,10 +174,11 @@ function loaderPageConfig(
169
174
// requestConfig 统一转成 PageRequestConfig 类型
170
175
if ( isObject ( rawConfig ) && Object . hasOwn ( rawConfig , 'requestConfigs' ) ) {
171
176
// CrawlPageConfigObject 处理
172
- const { requestConfigs, timeout, cookies, intervalTime, maxRetry } =
177
+ const { requestConfigs, proxy , timeout, cookies, intervalTime, maxRetry } =
173
178
rawConfig as CrawlPageConfigObject
174
179
175
180
// 给 loaderConfig 装载 API Config
181
+ loaderConfig . proxy = proxy
176
182
loaderConfig . cookies = cookies
177
183
loaderConfig . intervalTime = intervalTime
178
184
loaderConfig . maxRetry = maxRetry
@@ -215,10 +221,11 @@ function loaderDataConfig(
215
221
const requestObjecs : DataRequestConfig [ ] = [ ]
216
222
if ( isObject ( rawConfig ) && Object . hasOwn ( rawConfig , 'requestConfigs' ) ) {
217
223
// CrawlDataConfigObject 处理
218
- const { requestConfigs, timeout, intervalTime, maxRetry } =
224
+ const { requestConfigs, proxy , timeout, intervalTime, maxRetry } =
219
225
rawConfig as CrawlDataConfigObject
220
226
221
227
// 给 loaderConfig 装载 API Config
228
+ loaderConfig . proxy = proxy
222
229
loaderConfig . intervalTime = intervalTime
223
230
loaderConfig . maxRetry = maxRetry
224
231
loaderConfig . timeout = timeout
@@ -245,6 +252,7 @@ function loaderFileConfig(
245
252
) : LoaderCrawlFileConfig {
246
253
const loaderConfig : LoaderCrawlFileConfig = {
247
254
requestConfigs : [ ] ,
255
+ proxy : rawConfig . proxy ,
248
256
timeout : rawConfig . timeout ,
249
257
intervalTime : rawConfig . intervalTime ,
250
258
maxRetry : rawConfig . maxRetry ,
0 commit comments