From 64e005f8afa04dbdaad6e08d9edf217b8988590b Mon Sep 17 00:00:00 2001 From: waiting <1661926154@qq.com> Date: Wed, 24 Apr 2024 18:31:45 +0800 Subject: [PATCH] chore(mwcp): breaking change variable defaultfetchConfigCallbacks to defaultFetchConfigCallbacks --- .../midway-component-fetch/src/lib/fetch.component.ts | 10 +++++----- packages/midway-component-fetch/src/lib/helper.ts | 2 +- packages/midway-component-fetch/src/lib/index.ts | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/midway-component-fetch/src/lib/fetch.component.ts b/packages/midway-component-fetch/src/lib/fetch.component.ts index cc875952..85aeb0b6 100644 --- a/packages/midway-component-fetch/src/lib/fetch.component.ts +++ b/packages/midway-component-fetch/src/lib/fetch.component.ts @@ -15,7 +15,7 @@ import { ResponseData, } from '@waiting/fetch' -import { defaultfetchConfigCallbacks } from './helper.js' +import { defaultFetchConfigCallbacks } from './helper.js' import { Config, ConfigKey, FetchOptions } from './types.js' @@ -51,7 +51,7 @@ export class FetchComponent { const config = this.fetchConfig - await defaultfetchConfigCallbacks.beforeRequest({ + await defaultFetchConfigCallbacks.beforeRequest({ id, config, opts, @@ -95,7 +95,7 @@ export class FetchComponent { } if (config.enableTrace) { - await defaultfetchConfigCallbacks.afterResponse({ + await defaultFetchConfigCallbacks.afterResponse({ id, config, opts, @@ -113,8 +113,8 @@ export class FetchComponent { } const err = new Error(msg, { cause: ex }) if (config.enableTrace) { - if (typeof defaultfetchConfigCallbacks.processEx === 'function') { - return defaultfetchConfigCallbacks.processEx({ + if (typeof defaultFetchConfigCallbacks.processEx === 'function') { + return defaultFetchConfigCallbacks.processEx({ id, config: this.fetchConfig, opts, diff --git a/packages/midway-component-fetch/src/lib/helper.ts b/packages/midway-component-fetch/src/lib/helper.ts index a2f7b36a..e09b6416 100644 --- a/packages/midway-component-fetch/src/lib/helper.ts +++ b/packages/midway-component-fetch/src/lib/helper.ts @@ -216,7 +216,7 @@ export const processEx: Config['processEx'] = async (options) => { } } -export const defaultfetchConfigCallbacks = { +export const defaultFetchConfigCallbacks = { beforeRequest, afterResponse, processEx, diff --git a/packages/midway-component-fetch/src/lib/index.ts b/packages/midway-component-fetch/src/lib/index.ts index 667230f3..9f1df789 100644 --- a/packages/midway-component-fetch/src/lib/index.ts +++ b/packages/midway-component-fetch/src/lib/index.ts @@ -4,7 +4,7 @@ export * from './types.js' export { FetchComponent } from './fetch.component.js' export { FetchService } from './fetch.service.js' export { - defaultfetchConfigCallbacks, + defaultFetchConfigCallbacks, genRequestHeaders, } from './helper.js'