Skip to content

Commit 6a7276c

Browse files
committed
filteredUrlPatterns should take care of query strings too when trying to match
1 parent e0f00ae commit 6a7276c

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

src/services/pending-interceptor.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export class PendingInterceptorService implements HttpInterceptor {
3939
}
4040

4141
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
42-
const shouldBypass = this.shouldBypass(req.url);
42+
const shouldBypass = this.shouldBypass(req.urlWithParams);
4343

4444
if (!shouldBypass) {
4545
this._pendingRequests++;

test/components/spinner/spinner.component.spec.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,26 @@ describe('SpinnerComponent', () => {
151151
}
152152
)));
153153

154+
it('should take care of query strings in filteredUrlPatterns', fakeAsync(inject(
155+
[PendingInterceptorService, HttpClient, HttpTestingController],
156+
(service: PendingInterceptorService, http: HttpClient, httpMock: HttpTestingController) => {
157+
component.filteredUrlPatterns.push('bar');
158+
fixture.detectChanges();
159+
160+
http.get(
161+
'/api/service',
162+
{
163+
'params': {
164+
'foo': 'bar'
165+
}
166+
}
167+
).subscribe();
168+
tick();
169+
expect(component.isSpinnerVisible).toBeFalsy();
170+
httpMock.expectOne('/api/service?foo=bar').flush({});
171+
}
172+
)));
173+
154174
it('should correctly filter with several requests and one pattern', fakeAsync(inject(
155175
[PendingInterceptorService, HttpClient, HttpTestingController],
156176
(service: PendingInterceptorService, http: HttpClient, httpMock: HttpTestingController) => {

0 commit comments

Comments
 (0)