Closed yy-wow closed 1 week ago
The changes enhance the createHttp
function in packages/http/src/index.js
to support customizable request and response interceptors through new parameters, requestInterceptors
and responseInterceptors
. The function signature has been updated to default the options
parameter to an empty object. Additionally, new exports initHttp
and createHttp
are introduced in packages/design-core/index.js
, while a new preRequest
function is added in designer-demo/src/main.js
to modify HTTP request configurations.
File Path | Change Summary |
---|---|
packages/design-core/index.js | Added exports: initHttp and createHttp from @opentiny/tiny-engine-http . |
designer-demo/src/main.js | Added function preRequest(config) and utilized it as a request interceptor in createHttp . |
packages/http/src/index.js | Enhanced createHttp function to include requestInterceptors and responseInterceptors . |
Updated function signatures for createHttp , initHttp , and useHttp (no changes in some). |
sequenceDiagram
participant User
participant DesignCore
participant HttpModule
User->>DesignCore: Call initHttp()
DesignCore->>HttpModule: Initialize HTTP settings
User->>DesignCore: Call createHttp(options)
DesignCore->>HttpModule: Create HTTP instance with options
HttpModule->>User: Return HTTP instance
🐰 "In the core of design, new functions bloom,
initHttp
andcreateHttp
clear the room.
With interceptors now, requests take flight,
Custom paths we weave, in the day and night.
Hopping through code, we celebrate this cheer,
For every new feature brings us closer, my dear!" 🐇✨
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
English | 简体中文
PR
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
Background and solution
What is the current behavior?
支持传入自定义的拦截器
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
Other information
Summary by CodeRabbit
Summary by CodeRabbit
New Features
initHttp
andcreateHttp
methods for enhanced HTTP functionalities.createHttp
now supports customizable request interceptors, allowing for greater flexibility in handling HTTP communications.preRequest
function to modify HTTP request configurations.Bug Fixes
createHttp
function to ensure more robust performance.