Skip to content

Commit

Permalink
refactor:(0.3.0) refactor code improve performance and minor improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
suhaotian committed Mar 24, 2024
1 parent 3945a96 commit 5f8edf7
Show file tree
Hide file tree
Showing 29 changed files with 368 additions and 221 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ jobs:
version: 8

- name: Install dependencies
run: pnpm install && pnpm build
run: pnpm install

- name: Check type
run: pnpm checktype

- name: Run tests
run: pnpm test
run: pnpm dev:test

- name: Run vitest mock tests
run: pnpm --filter=vitest-mock-example test
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# CHANGELOG 📝

## v0.3.0 2024/03/24

- fix(core): POST/DELETE/PUT/PATCH methods when have `data`, use formData to body(before put in url)
- refactor(core): default request inteceptor should work before send fetch
- refactor(core): remove `_data` in request config
- refactor(core): remove `encode` in options, use `paramsSerializer` option instead
- chore(README): add encrypt/decrypt to README

## v0.2.6 2024/03/22

- fix(core): when post with `headers: { 'content-type': 'application/x-www-form-urlencoded' }`, shouldn't post with body
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,6 @@ instance.interceptors.request.use((req) => {
const result = JSON.stringify(req.data);
const blob = encrypt(result);
req.data = { blob };
req._data = JSON.stringify({ blob });
}

return req;
Expand Down
2 changes: 1 addition & 1 deletion bun-example/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import throttlePlugin from 'xior/plugins/throttle';
// console.log(merge, delay, buildSortedURL);

const instance = xior.create({
encode: (params: Record<string, any>) => stringify(params),
paramsSerializer: (params: Record<string, any>) => stringify(params),
});
instance.plugins.use(errorRetryPlugin({}));
instance.plugins.use(cachePlugin({}));
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "xior",
"version": "0.2.6",
"version": "0.3.0",
"description": "A lite request lib based on fetch with plugins support, and axios similar API",
"repository": "suhaotian/xior",
"bugs": "https://github.com/suhaotian/xior/issues",
Expand Down Expand Up @@ -63,7 +63,7 @@
"build:lib": "rm -rf lib && tsc --project tsconfig.json",
"build:umd": "pnpm build:lib && pnpm webpack --config ./scripts/webpack.config.mjs",
"test": "pnpm --filter=xior-tests test",
"dev:test": "pnpm build && pnpm test",
"dev:test": "bunchee && pnpm test",
"checktype": "tsc --noEmit",
"start-publish": "pnpm build && pnpm build:umd && node scripts/purge-pkg-for-publish.mjs && npm publish --registry=https://registry.npmjs.org",
"push": "git push && git lfs push --all origin",
Expand Down
Loading

0 comments on commit 5f8edf7

Please sign in to comment.