Skip to content

Commit 78463b7

Browse files
committed
fix(http): clean options only event specify
1 parent 936aada commit 78463b7

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

src/providers/http.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,8 @@ export class Http {
280280

281281
this.events[methodName].call(this.events, (req: any, subscribe: any) => {
282282
this.plugins.runEvent(method, [ req, subscribe ]);
283-
if (method === 'postRequest' || method === 'postRequestError') {
284-
this.plugins.cleanOptions();
283+
if (method === 'postRequest') {
284+
this.plugins.cleanOptions(method);
285285
}
286286
});
287287
}

src/providers/plugins/plugins.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,15 @@ export class Plugins {
116116
}
117117
}
118118

119-
cleanOptions() {
119+
cleanOptions(event: string) {
120120
this.forEach((plugin: Plugin) => {
121121
if ('restoreOptions' in plugin) {
122-
plugin.restoreOptions();
122+
if (event && event in plugin) {
123+
plugin.restoreOptions();
124+
}
123125
}
126+
this.options[plugin.getName()] = {};
124127
});
125-
this.options = {};
126128
}
127129

128130
setOptions(options: Object): this {

0 commit comments

Comments
 (0)