Get httpclient request query parameters

292 Views Asked by At

Hi I am using an Angular 5 interceptor to check if the HttpClient request URL contains query params but it always comes back false even though in Network I see the query param being passed.

import { HttpEvent, HttpInterceptor, HttpHandler, HttpRequest, HttpParams } from '@angular/common/http';
...

intercept (req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
if (!req.params.has('X-Amz-Algorithm')) {
    do something
} else {}
}

Could someone help me on how to retrieve the query params being used in the HttpRequest. Thank you!

0

There are 0 best solutions below