Skip to content

Commit

Permalink
v0.5.2
Browse files Browse the repository at this point in the history
  • Loading branch information
suhaotian committed Jul 9, 2024
1 parent ab1cc23 commit 2cf4a40
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 28 deletions.
35 changes: 35 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,40 @@
# CHANGELOG 📝

## v0.5.2 2024/7/9

- Fix(core): if params include `Date` value, call `.toISOString()` and utils `encodeParams` support options `allowDot: true` and `arrayFormat: 'indices' | 'repeat' | 'brackets'`(default is `'indices'`). Fix [issues/22](https://github.com/suhaotian/xior/issues/22) and [issues/23](https://github.com/suhaotian/xior/issues/23)

---

**Code example:**

```ts
import xior, { encodeParams } from 'xior';

const filter = {
ids: [1, 2, 3],
dateFrom: new Date(),
dateTo: new Date(),
};

const http = xior.create({
paramsSerializer: (params: any) =>
encodeParams(params, true, null, {
allowDots: false,
arrayFormat: 'indices', // 'indices' | 'repeat' | 'brackets'
serializeDate: (date) => date.toISOString(),
}),
});

/*
'indices': { a: ['b', 'c'] } -> 'a[0]=b&a[1]=c'
'brackets': { a: ['b', 'c'] } -> 'a[]=b&a[]=c'
'repeat': { a: ['b', 'c'] } -> 'a=b&a=c'
*/

http.get('https://example.com', { params: { filter } });
```

## v0.5.1 2024/5/28

- Feat(core): if request config `withCredentials: true`, before useless, now will set fetch config `credentials: 'include'`. Fix [issues/19](https://github.com/suhaotian/xior/issues/19)
Expand Down
52 changes: 26 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ yarn add xior
Use jsDelivr CDN:

```html
<script src="https://cdn.jsdelivr.net/npm/[email protected].1/dist/xior.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected].2/dist/xior.umd.js"></script>

<!-- Usage -->
<script>
Expand All @@ -114,7 +114,7 @@ Use jsDelivr CDN:
Use unpkg CDN:

```html
<script src="https://unpkg.com/[email protected].1/dist/xior.umd.js"></script>
<script src="https://unpkg.com/[email protected].2/dist/xior.umd.js"></script>

<!-- Usage -->
<script>
Expand Down Expand Up @@ -561,9 +561,9 @@ Use CDN:
Using jsDelivr CDN:

```html
<script src="https://cdn.jsdelivr.net/npm/[email protected].1/dist/xior.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected].2/dist/xior.umd.js"></script>
<!-- Load plugin -->
<script src="https://cdn.jsdelivr.net/npm/[email protected].1/plugins/error-retry.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected].2/plugins/error-retry.umd.js"></script>

<!-- Usage -->
<script>
Expand All @@ -576,10 +576,10 @@ Using jsDelivr CDN:
Using unpkg CDN:

```html
<script src="https://unpkg.com/[email protected].1/dist/xior.umd.js"></script>
<script src="https://unpkg.com/[email protected].2/dist/xior.umd.js"></script>

<!-- Load plugin -->
<script src="https://unpkg.com/[email protected].1/plugins/error-retry.umd.js"></script>
<script src="https://unpkg.com/[email protected].2/plugins/error-retry.umd.js"></script>

<!-- Usage -->
<script>
Expand Down Expand Up @@ -672,9 +672,9 @@ Use CDN:
Using jsDelivr CDN:

```html
<script src="https://cdn.jsdelivr.net/npm/[email protected].1/dist/xior.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected].2/dist/xior.umd.js"></script>
<!-- Load plugin -->
<script src="https://cdn.jsdelivr.net/npm/[email protected].1/plugins/throttle.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected].2/plugins/throttle.umd.js"></script>

<!-- Usage -->
<script>
Expand All @@ -687,10 +687,10 @@ Using jsDelivr CDN:
Using unpkg CDN:

```html
<script src="https://unpkg.com/[email protected].1/dist/xior.umd.js"></script>
<script src="https://unpkg.com/[email protected].2/dist/xior.umd.js"></script>

<!-- Load plugin -->
<script src="https://unpkg.com/[email protected].1/plugins/throttle.umd.js"></script>
<script src="https://unpkg.com/[email protected].2/plugins/throttle.umd.js"></script>

<!-- Usage -->
<script>
Expand Down Expand Up @@ -745,9 +745,9 @@ Use CDN:
Using jsDelivr CDN:

```html
<script src="https://cdn.jsdelivr.net/npm/[email protected].1/dist/xior.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected].2/dist/xior.umd.js"></script>
<!-- Load plugin -->
<script src="https://cdn.jsdelivr.net/npm/[email protected].1/plugins/dedupe.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected].2/plugins/dedupe.umd.js"></script>

<!-- Usage -->
<script>
Expand All @@ -760,10 +760,10 @@ Using jsDelivr CDN:
Using unpkg CDN:

```html
<script src="https://unpkg.com/[email protected].1/dist/xior.umd.js"></script>
<script src="https://unpkg.com/[email protected].2/dist/xior.umd.js"></script>

<!-- Load plugin -->
<script src="https://unpkg.com/[email protected].1/plugins/dedupe.umd.js"></script>
<script src="https://unpkg.com/[email protected].2/plugins/dedupe.umd.js"></script>

<!-- Usage -->
<script>
Expand Down Expand Up @@ -825,9 +825,9 @@ Use CDN:
Using jsDelivr CDN:

```html
<script src="https://cdn.jsdelivr.net/npm/[email protected].1/dist/xior.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected].2/dist/xior.umd.js"></script>
<!-- Load plugin -->
<script src="https://cdn.jsdelivr.net/npm/[email protected].1/plugins/error-cache.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected].2/plugins/error-cache.umd.js"></script>

<!-- Usage -->
<script>
Expand All @@ -840,10 +840,10 @@ Using jsDelivr CDN:
Using unpkg CDN:

```html
<script src="https://unpkg.com/[email protected].1/dist/xior.umd.js"></script>
<script src="https://unpkg.com/[email protected].2/dist/xior.umd.js"></script>

<!-- Load plugin -->
<script src="https://unpkg.com/[email protected].1/plugins/error-cache.umd.js"></script>
<script src="https://unpkg.com/[email protected].2/plugins/error-cache.umd.js"></script>

<!-- Usage -->
<script>
Expand Down Expand Up @@ -988,9 +988,9 @@ Use CDN:
Using jsDelivr CDN:

```html
<script src="https://cdn.jsdelivr.net/npm/[email protected].1/dist/xior.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected].2/dist/xior.umd.js"></script>
<!-- Load plugin -->
<script src="https://cdn.jsdelivr.net/npm/[email protected].1/plugins/progress.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected].2/plugins/progress.umd.js"></script>

<!-- Usage -->
<script>
Expand All @@ -1003,10 +1003,10 @@ Using jsDelivr CDN:
Using unpkg CDN:

```html
<script src="https://unpkg.com/[email protected].1/dist/xior.umd.js"></script>
<script src="https://unpkg.com/[email protected].2/dist/xior.umd.js"></script>

<!-- Load plugin -->
<script src="https://unpkg.com/[email protected].1/plugins/progress.umd.js"></script>
<script src="https://unpkg.com/[email protected].2/plugins/progress.umd.js"></script>

<!-- Usage -->
<script>
Expand Down Expand Up @@ -1113,9 +1113,9 @@ Use CDN:
Using jsDelivr CDN:

```html
<script src="https://cdn.jsdelivr.net/npm/[email protected].1/dist/xior.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected].2/dist/xior.umd.js"></script>
<!-- Load plugin -->
<script src="https://cdn.jsdelivr.net/npm/[email protected].1/plugins/mock.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected].2/plugins/mock.umd.js"></script>

<!-- Usage -->
<script>
Expand All @@ -1128,10 +1128,10 @@ Using jsDelivr CDN:
Using unpkg CDN:

```html
<script src="https://unpkg.com/[email protected].1/dist/xior.umd.js"></script>
<script src="https://unpkg.com/[email protected].2/dist/xior.umd.js"></script>

<!-- Load plugin -->
<script src="https://unpkg.com/[email protected].1/plugins/mock.umd.js"></script>
<script src="https://unpkg.com/[email protected].2/plugins/mock.umd.js"></script>

<!-- Usage -->
<script>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "xior",
"version": "0.5.1",
"version": "0.5.2",
"description": "A lite request lib based on fetch with plugin support and similar API to axios.",
"repository": "suhaotian/xior",
"bugs": "https://github.com/suhaotian/xior/issues",
Expand Down
2 changes: 1 addition & 1 deletion src/xior.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export class Xior {
static create(options?: XiorRequestConfig): XiorInstance {
return new Xior(options);
}
static VERSION = '0.5.1';
static VERSION = '0.5.2';

config?: XiorRequestConfig;
defaults: XiorInterceptorRequestConfig;
Expand Down

0 comments on commit 2cf4a40

Please sign in to comment.