Skip to content

Commit

Permalink
Merge pull request #1011 from goltra/main
Browse files Browse the repository at this point in the history
Feat: Function to clear and check if exist an interceptor in client-fetch
  • Loading branch information
mrlubos authored Sep 11, 2024
2 parents c541ee8 + deaf901 commit e4da79c
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/tall-bees-cheer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hey-api/client-fetch': minor
---

feat: Function to clear and check if exist an interceptor in client-fetch
8 changes: 8 additions & 0 deletions packages/client-fetch/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,14 @@ class Interceptors<Interceptor> {
this._fns = [];
}

clear() {
this._fns = [];
}

exists(fn: Interceptor) {
return this._fns.indexOf(fn) !== -1;
}

eject(fn: Interceptor) {
const index = this._fns.indexOf(fn);
if (index !== -1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,14 @@ class Interceptors<Interceptor> {
this._fns = [];
}
clear() {
this._fns = [];
}
exists(fn: Interceptor) {
return this._fns.indexOf(fn) !== -1;
}
eject(fn: Interceptor) {
const index = this._fns.indexOf(fn);
if (index !== -1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,14 @@ class Interceptors<Interceptor> {
this._fns = [];
}
clear() {
this._fns = [];
}
exists(fn: Interceptor) {
return this._fns.indexOf(fn) !== -1;
}
eject(fn: Interceptor) {
const index = this._fns.indexOf(fn);
if (index !== -1) {
Expand Down

0 comments on commit e4da79c

Please sign in to comment.